Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. from kivy.app import App
  2. from kivy.lang import Builder
  3. from kivy.uix.boxlayout import BoxLayout
  4.  
  5. class TestApp(App):
  6. def build(self):
  7. kv = '''
  8. <RecycleItem@BoxLayout>:
  9. canvas:
  10. Rectangle:
  11. pos: self.pos
  12. size: root.size
  13. canvas.before:
  14. Color:
  15. rgba: 1, 0, 0, 0
  16. valign: 'top'
  17. pos_hint: {'x' : 0, 'y': 0}
  18. orientation: 'horizontal'
  19. size_hint_y: None
  20. height: self.minimum_height
  21. spacing: dp(46)
  22. callbacks: None
  23. TextInput:
  24. on_text: root.callbacks.textChanged(self)
  25. BoxLayout:
  26. padding: dp(20)
  27. RecycleView:
  28. canvas.before:
  29. Color:
  30. rgba: 1, 0, 0, 0
  31. Rectangle:
  32. pos: self.pos
  33. size: self.size
  34. id: recipe_rv
  35. padding: dp(20)
  36.  
  37. scroll_type: ['bars', 'content']
  38. scroll_wheel_distance: dp(114)
  39. viewclass: 'RecycleItem'
  40. RecycleBoxLayout:
  41. default_size: None, dp(60)
  42. default_size_hint: 1, None
  43. size_hint_y: None
  44. height: self.minimum_height
  45. orientation: 'vertical'
  46. spacing: dp(2)
  47. '''
  48. self.v = Builder.load_string(kv)
  49. self.v.ids.recipe_rv.data = [{'callbacks': self}, {'callbacks': self}, {'callbacks': self}]
  50. return self.v
  51.  
  52. def textChanged(self, tf):
  53. self.v.ids.recipe_rv.refresh_from_data()
  54.  
  55. if __name__ == '__main__':
  56. # kwad.attach()
  57. TestApp().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement