[英]Can't scroll in scroll view in kivy
我需要一个带有许多按钮的屏幕,我正在循环创建它。它应该是可滚动的。 但是当我执行此代码时,它的工作原理就像页面大小等于滚动视图小部件,所以我无法向下滚动,它的反应就像我正在通过边框过度滚动一样。Python 代码:
class List_of_days(Screen):
date = date
days = get_last_n(7,date)
def on_enter(self, *args):
print(self.days)
for i in range(0,100):
self.grid.add_widget(Button(text='ура'))
kivy 文件:
<List_of_days>:
grid:grid
ScrollView:
do_scroll_x: False
BoxLayout:
size_hint_y: None
orientation: 'vertical'
Button:
size_hint_y: None
text: "Назад"
on_press:
app.sm.current = 'menu'
BoxLayout:
size_hint_y: None
ToggleButton:
text: '7 дней'
group:'number_of_days'
id: btn_7days
ToggleButton:
id:btn_30days
text: '30 дней'
group:'number_of_days'
ToggleButton:
id:btn_all_days
text: 'Все'
group:'number_of_days'
GridLayout:
size_hint_y:None
id:grid
padding: 10,10
spacing: 5
row_default_height:100
cols: 3
在你kv
中,添加:
height: self.minimum_height
到顶层BoxLayout
和GridLayout
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.