Python Kivy ScrollView
Python Kivy ScrollViev
如果可能的话,有人可以给我发一个 kivy 语言的代码示例,其中包含简单的水平框布局,其中一侧是带有按钮的滚动视图,而另一侧只是一个名为“测试标签”的标签。我不知道滚动视图是如何工作的,我相信这会有帮助。我找到了 ,但对我来说这看起来真的很复杂,我无法理解它。
滚动视图最多包含一个小部件,通常是一个包含许多小部件或一个大小部件的布局,这里是一个简单的示例
main.py :
from kivy.app import App
class Main(App):
pass
Main().run()
main.kv 文件
BoxLayout:
orientation:'horizontal'
Label:
text:'test label'
ScrollView:
BoxLayout:
orientation:"vertical"
size_hint_y:None
height:self.minimum_height
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
如果可能的话,有人可以给我发一个 kivy 语言的代码示例,其中包含简单的水平框布局,其中一侧是带有按钮的滚动视图,而另一侧只是一个名为“测试标签”的标签。我不知道滚动视图是如何工作的,我相信这会有帮助。我找到了
滚动视图最多包含一个小部件,通常是一个包含许多小部件或一个大小部件的布局,这里是一个简单的示例
main.py :
from kivy.app import App
class Main(App):
pass
Main().run()
main.kv 文件
BoxLayout:
orientation:'horizontal'
Label:
text:'test label'
ScrollView:
BoxLayout:
orientation:"vertical"
size_hint_y:None
height:self.minimum_height
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'
Button:
size_hint_y:None
height:'100dp'