Хочу изменить местоположение этого текста, но когда меняю halign: "center" на halign: "top" программа завершает работу с ошибкой.
Вот код:
from kivy.lang import Builder
from kivy.properties import ObjectProperty
from kivymd.app import MDApp
from kivymd.uix.boxlayout import MDBoxLayout
KV = '''
<ContentNavigationDrawer>
ScrollView:
MDList:
OneLineListItem:
text: "One"
on_press:
root.nav_drawer.set_state("close")
root.screen_manager.current = "la 1"
OneLineListItem:
text: "Two"
on_press:
root.nav_drawer.set_state("close")
root.screen_manager.current = "la 2"
OneLineListItem:
text: "Three"
on_press:
root.nav_drawer.set_state("close")
root.screen_manager.current = "la 3"
MDScreen:
MDToolbar:
id: toolbar
pos_hint: {"top": 1}
elevation: 10
title: "MDNavigationDrawer"
left_action_items: [["menu", lambda x: nav_drawer.set_state("open")]]
MDNavigationLayout:
x: toolbar.height
ScreenManager:
id: screen_manager
MDScreen:
name: "la 1"
MDLabel:
text: "Screen 1"
halign: "center"
MDScreen:
name: "la 2"
MDLabel:
text: "Screen 2"
halign: "center"
MDScreen:
name: "la 3"
MDLabel:
text: "Screen 3"
halign: "center"
MDNavigationDrawer:
id: nav_drawer
ContentNavigationDrawer:
screen_manager: screen_manager
nav_drawer: nav_drawer
'''
class ContentNavigationDrawer(MDBoxLayout):
screen_manager = ObjectProperty()
nav_drawer = ObjectProperty()
class TestNavigationDrawer(MDApp):
def build(self):
return Builder.load_string(KV)
TestNavigationDrawer().run()