我是第一次使用该Kivy库,并尝试使用TabbedPanel. 我会设置每个选项卡的大小(x在代码中TabbedPanelItem)以适合整个TabbedPanel宽度,但如果我在文件中使用height或,似乎它们不起作用。size_hint.kv
这是我的 kv 代码:
#:import sm kivy.uix.screenmanager
ScreenManagement:
transition: sm.FadeTransition()
SecondScreen:
<SecondScreen>:
tabba: tabba
name: 'second'
FloatLayout:
background_color: (255, 255, 255, 1.0)
BoxLayout:
orientation: 'vertical'
size_hint: 1, 0.10
pos_hint: {'top': 1.0}
canvas:
Color:
rgba: (0.98, 0.4, 0, 1.0)
Rectangle:
pos: self.pos
size: self.size
Label:
text: 'MyApp'
font_size: 30
size: self.texture_size
BoxLayout:
orientation: 'vertical'
size_hint: 1, 0.90
Tabba:
id: tabba
BoxLayout:
orientation: 'vertical'
size_hint: 1, 0.10 …Run Code Online (Sandbox Code Playgroud)