【发布时间】:2021-10-11 05:19:02
【问题描述】:
我创建了一个包含 100 个按钮的堆栈布局。仅此一项就可以了,但是当我在滚动视图布局下添加堆栈布局时,屏幕上不会显示任何内容。without using scroll view
Python 代码
from kivy.app import App
from kivy.metrics import dp
from kivy.uix.stacklayout import StackLayout
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.scrollview import ScrollView
class stacklayoutex(StackLayout):
def __init__(self,**kwargs):
super().__init__(**kwargs)
for i in range(100):
b=Button(text=str(i+1),size_hint=(None,None),size=(dp(100),dp(100)))
self.add_widget(b)
class MainWidget(Widget):
pass
class TheLabApp(App):
pass
TheLabApp().run()
KV 文件
scrollviewex:
<scrollviewex@ScrollView>:
stacklayoutex:
size_hint: 1,None
height:4000
<stacklayoutex>:
【问题讨论】:
标签: python user-interface kivy scrollview kivymd