我正在尝试用垂直拆分器构造一个屏幕来分离内容;但是,即使在咨询了kivy文档并浏览了此处的相关问题之后,我仍未能找到解决方案。
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.splitter import Splitter
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.relativelayout import RelativeLayout
from kivy.properties import StringProperty, DictProperty
from kivy.uix.screenmanager import ScreenManager, Screen
kv = '''
ScreenManagement:
id: 'manager'
MainScreen:
name: 'main'
manager: 'manager'
<MainScreen>:
BoxLayout:
orientation: 'vertical'
Button:
text: 'New'
Splitter:
sizeable_from: 'top'
Button:
text: 'test'
'''
class ScreenManagement(ScreenManager):
pass
class MainScreen(Screen):
pass
class MyApp(App):
def build(self):
return Builder.load_string(kv)
MyApp().run()
这是我目前在这段代码中看到的
如您所见,分离器在第二个按钮旁边而不是水平按钮之间;激活分离器后,它将水平(而不是垂直)收缩按钮。如何更改代码以获得我想要的效果?
答案 0 :(得分:1)
简单的拼写错误。 sizeable_from
应该是sizable_from
。