Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from kivy.app import App
- from kivy.lang import Builder
- from kivy.uix.boxlayout import BoxLayout
- class TestApp(App):
- def build(self):
- kv = '''
- <RecycleItem@BoxLayout>:
- canvas:
- Rectangle:
- pos: self.pos
- size: root.size
- canvas.before:
- Color:
- rgba: 1, 0, 0, 0
- valign: 'top'
- pos_hint: {'x' : 0, 'y': 0}
- orientation: 'horizontal'
- size_hint_y: None
- height: self.minimum_height
- spacing: dp(46)
- callbacks: None
- TextInput:
- on_text: root.callbacks.textChanged(self)
- BoxLayout:
- padding: dp(20)
- RecycleView:
- canvas.before:
- Color:
- rgba: 1, 0, 0, 0
- Rectangle:
- pos: self.pos
- size: self.size
- id: recipe_rv
- padding: dp(20)
- scroll_type: ['bars', 'content']
- scroll_wheel_distance: dp(114)
- viewclass: 'RecycleItem'
- RecycleBoxLayout:
- default_size: None, dp(60)
- default_size_hint: 1, None
- size_hint_y: None
- height: self.minimum_height
- orientation: 'vertical'
- spacing: dp(2)
- '''
- self.v = Builder.load_string(kv)
- self.v.ids.recipe_rv.data = [{'callbacks': self}, {'callbacks': self}, {'callbacks': self}]
- return self.v
- def textChanged(self, tf):
- self.v.ids.recipe_rv.refresh_from_data()
- if __name__ == '__main__':
- # kwad.attach()
- TestApp().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement