Я пытаюсь создать экран с некоторыми кнопками переключения меню, а затем вложенным диспетчером экрана, который я могу переключить диспетчер экрана только внутри контейнера и оставить меню вне контейнера неповрежденным. Когда я использовал комбинацию Boxlayouts и Gridlayouts, все шло между собой.Проблема с Kivy с вложенным screenmanager
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.label import Label
from kivy.graphics.context_instructions import Color
from kivy.uix.screenmanager import Screen, ScreenManager
class ScreenManagement(FloatLayout):
pass
class IomApp(App):
def build(self):
return ScreenManagement()
if __name__ == '__main__':
IomApp().run()
Kivy файл:
<[email protected]>:
height: '40dp'
font_size: 18
<[email protected]>:
height: '40dp'
size_hint_y: None
font_size: 18
write_tab: False
multiline: False
on_text_validate: root.foo()
<ScreenManagement>:
BoxLayout:
orientation: "vertical"
BoxLayout:
height: "80dp"
size_hint_y: None
Label:
text: 'Patient info Label'
BoxLayout:
orientation: 'horizontal'
BoxLayout:
orientation: 'vertical'
size_hint_x: 20
ToggleButton:
text: 'Case Info'
group: 'g1'
on_screen:
ToggleButton:
text: 'Modalities'
group: 'g1'
ToggleButton:
text: 'Report Editing'
group: 'g1'
ToggleButton:
text: 'Printing/Exporting'
group: 'g1'
ToggleButton:
text: 'Settings'
group: 'g1'
BoxLayout:
orientation: 'vertical'
size_hint_x: 80
ScreenManager:
id: "Screen1"
Screen:
name: "Case_info_screen"
BoxLayout:
orientation: 'vertical'
spacing: 20
orientation: 'vertical'
size_hint: (.5, .5)
pos_hint: {'center_x':.5, 'center_y':.5}
Label:
text: "Case Info"
size_hint_y: 25
GridLayout:
cols: 2
padding: 50
spacing: 15
size_hint_y: 50
LabelCases:
text: 'First Name: '
TextInputCases:
LabelCases:
text: 'Last Name: '
TextInputCases:
LabelCases:
text: 'MRN: '
TextInputCases:
LabelCases:
text: 'Date of Birth: '
TextInputCases:
LabelCases:
text: 'Hospital: '
TextInputCases:
LabelCases:
text: 'Diagnosis: '
TextInputCases:
Label:
text: "Surgical and Techical Staff"
size_hint_y: 25
BoxLayout:
Button:
height: "40dp"
size_hint_y: None
text: "Back"
Button:
height: "40dp"
size_hint_y: None
text: "Next"