假设我有一个用kv编写的布局,并且定义了一个BoxLayout
值的id
,那么以后如何在没有Kv语言的情况下将更多的小部件添加到该布局中呢?我可以在python中执行此操作,但我觉得用Kv语言执行此操作会更有效。
以下是一些示例代码(注意:Widgets
是BoxLayout
):
<Content@BoxLayout>:
orientation: 'vertical'
Button:
text: 'Test'
BoxLayout:
id: to_change
orientation: 'horizontal'
Button:
text: 'Button 1'
<Widgets>:
orientation: 'vertical'
Content:
# How would I add this button to the layout called "to_change"?
to_change:
Button:
text: 'Button 2'