2024-09-27 09:29:53 发布
网友
让我们在我的kv文件中说,我这样做
<BigButton@Button>: text: "demo" some_other_things: True
如何在py中添加此小部件?这不起作用:
someWidget=self.ids.someWidgetID TestButton=BigButton(some_other_other_things=False) someWidget.add_widget(TestButton)
它抛出一个未定义BigButton的名称错误
谢谢你的帮助
回答我自己的问题: 要创建此类小部件,请使用Factory
from kivy.factory import Factory someParentWidget = self.ids.someParentWidgetID TestButton = Factory.BigButton() TestButton.some_other_other_thing=True someParentWidget.add_widget(TestButton)
回答我自己的问题: 要创建此类小部件,请使用Factory
相关问题 更多 >
编程相关推荐