【发布时间】:2021-10-16 13:03:34
【问题描述】:
我想知道在哪里可以看到和使用在创建小部件期间数据上提供的参数。
问题:__init__ 似乎没有信息,因此必须在调用之后进行,所以我想知道何时可以使用我的自定义参数。
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.recycleview import RecycleView
from kivy.factory import Factory as F
Builder.load_string('''
<RV>:
viewclass: 'CustomLabel'
RecycleBoxLayout:
default_size: None, dp(56)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
''')
class CustomLabel(F.Label):
def __init__(self, **kwargs):
super().__init__(**kwargs)
print(kwargs, "why can't I see the stuff from data ???")
class RV(RecycleView):
def __init__(self, **kwargs):
super(RV, self).__init__(**kwargs)
self.data = [{'text': str(x), "new_parameter":"idk where am I"} for x in range(100)]
class TestApp(App):
def build(self):
return RV()
if __name__ == '__main__':
TestApp().run()
【问题讨论】:
标签: python kivy recycleview