【发布时间】:2021-01-15 17:04:38
【问题描述】:
我正在学习 kivy 布局:网格布局,我在 .kv 文件中创建了几个按钮
<Grid_Layout>:
GridLayout:
size: root.width, root.height
rows: 3
cols: 3
Button:
text: "Top Left"
on_touch_up: print("HI")
Button:
text: "Top Center"
Button:
text: "Top Right"
Button:
text: "Center Left"
Button:
text: "Center Center"
Button:
text: "Center Right"
Button:
text: "Bottom Left"
Button:
text: "Bottom Center"
Button:
text: "Bottom Right"
想问:
- 如果不加
size: root.width, root.height整个布局会一起收缩,有什么解决办法吗? - 就像按下一个特定的按钮一样,它会做一些事情,但它们并不相同。我试过
on_touch_up: print("HI"),但无论我按下哪个按钮,它都会打印“HI”,哈哈,但我不想要这个:(所以想问有没有解决方案?:)
谢谢 :)
【问题讨论】: