Хотите добавить файл kv в другой файл kv

0

Я пытаюсь добавить kv-файл (SymptomTracker.kv) для доступа через другой kv-файл (BladderDiary.kv) с помощью кнопки или, по крайней мере, через ScreenManager. Я не могу этого сделать и был бы признателен за помощь в этой области.

Это мой BladderDiary.kv

<BladderDiary>:
ScrollView:
    do_scroll_x: False
    do_scroll_y: True
    GridLayout:
        rows: 3
        size:(root.width, root.height)
        size_hint_y: None ## Without size hint scroll doesnt work, but it keeps 'bouncing' probably a problem with the screen size
        height: self.minimum_height
        row_default_height: 180
        #row_force_default: True 
        MDList:
            id: BladderDiary
        MDList:
            id: BladderSummary
        MDRoundFlatButton:
            text: "Back"
            on_press:
                root.parent.current = "PatientHomePage"

И мой SymptomTracker.kv

<SymptomTracker>:
id:SymptomTracker
name: 'SymptomTracker'
FloatLayout:
    MDLabel:
        id: Symptom_T
        text: "How are your symptoms!"
        font_size: 40
        halign: 'center'
        size_hint_y: None
        pos_hint: {"top": .9, "center_x": .5}
        height: self.texture_size[1]  

    MDRoundFlatButton:
        text: "Open Date Picker!"
        font_size: 25
        size_hint: .5, .06
        pos_hint: {"top":0.7, "center_x": 0.5}
        on_release: root.show_date_picker()

    MDLabel:
        id: date_label
        text: "Some Stuff!"
        pos_hint: {"top":0.6, "center_x": 0.95}

    MDRoundFlatButton:
        text: "Back"
        font_size: 25
        size_hint: .5, .06
        pos_hint: {"top":0.3, "center_x": 0.5}
        on_release:
            root.parent.current = "PatientHomePage"
            # root.manager.transition.direction = "right"

GridLayout:
    rows: 3
    cols: 5
    pos_hint: {"center_y":0.2, "center_x": 0.65}
    MDIconButton:
        id: ButtonOne
        icon: "./Styles/SymptomTrackerIcons/Fatigue.png"
        pos_hint: {"top":1, "center_x": 0.3}
        theme_text_color: 'Custom'
        text_color: app.theme_cls.primary_color
        user_font_size: 90
        on_release:
            root.SendSymptom(button = 'button1')

    MDIconButton:
        id: ButtonTwo
        icon: "./Styles/SymptomTrackerIcons/SwollenLeg.png"
        pos_hint: {"top":1, "center_x": 0.3}
        theme_text_color: 'Custom'
        text_color: app.theme_cls.primary_color
        user_font_size: 90
        on_release:
            root.SendSymptom(button = 'button2')

    MDIconButton:
        id: ButtonThree
        icon: "./Styles/SymptomTrackerIcons/Fever.png"
        pos_hint: {"top":1, "center_x": 0.3}
        theme_text_color: 'Custom'
        text_color: app.theme_cls.primary_color
        user_font_size: 90
        on_release:
            root.SendSymptom(button = 'button3')
    MDIconButton:
        id: ButtonFour
        icon: "./Styles/SymptomTrackerIcons/Nausea.png"
        pos_hint: {"top":1, "center_x": 0.3}
        theme_text_color: 'Custom'
        text_color: app.theme_cls.primary_color
        user_font_size: 90
        on_release:
            root.SendSymptom(button = 'button4')

    MDIconButton:
        id: ButtonFive
        icon: "./Styles/SymptomTrackerIcons/Headache.png"
        # pos_hint: {"top":1, "center_x": 0.3}
        theme_text_color: 'Custom'
        text_color: app.theme_cls.primary_color
        user_font_size: 90
        on_release:
            root.SendSymptom(button = 'button5')

    MDIconButton:
        id: ButtonSix
        icon: "./Styles/SymptomTrackerIcons/Leaks.png"
        pos_hint: {"top":1, "center_x": 0.3}
        theme_text_color: 'Custom'
        text_color: app.theme_cls.primary_color
        user_font_size: 90

    MDIconButton:
        id: ButtonSeven
        icon: "./Styles/SymptomTrackerIcons/Foulsmell.png"
        pos_hint: {"top":1, "center_x": 0.3}
        theme_text_color: 'Custom'
        text_color: app.theme_cls.primary_color
        user_font_size: 90
        on_release:
            root.callback(button = 'button7')

    MDIconButton:
        id: ButtonEight
        icon: "./Styles/SymptomTrackerIcons/pelvicpain.png"
        pos_hint: {"top":1, "center_x": 0.3}
        theme_text_color: 'Custom'
        text_color: app.theme_cls.primary_color
        user_font_size: 90
        on_release:
            root.callback(button = 'button8')

    MDIconButton:
        id: ButtonNine
        icon: "./Styles/SymptomTrackerIcons/cloudyurine.png"
        pos_hint: {"top":1, "center_x": 0.3}
        theme_text_color: 'Custom'
        text_color: app.theme_cls.primary_color
        user_font_size: 90
        on_release:
            root.callback(button = 'button9')

    MDIconButton:
        id: ButtonTen
        icon: "./Styles/SymptomTrackerIcons/crampsonside.png"
        pos_hint: {"top":1, "center_x": 0.3}
        theme_text_color: 'Custom'
        text_color: app.theme_cls.primary_color
        user_font_size: 90
        on_release:
            root.callback(button = 'button10')

    MDIconButton:
        id: ButtonEleven
        icon: "./Styles/SymptomTrackerIcons/hesitancytourinate.png"
        pos_hint: {"top":1, "center_x": 0.3}
        theme_text_color: 'Custom'
        text_color: app.theme_cls.primary_color
        user_font_size: 90
        on_release:
            root.callback(button = 'button11')

Не уверен, что это поможет, но мой файл main.py здесь

from kivymd.app import MDApp
from kivy.lang import Builder

class MainApp(MDApp):
user_idToken_doctor = ""
local_id_doctor = ""
user_idToken_patient = ""
local_id_patient = ""
UserID_Patient = ""
UserID_Doctor = ""


Builder.load_file("./Pages/Patient_LogIn.kv")
Builder.load_file("./Pages/Doctor_LogIn.kv")
Builder.load_file("./Pages/WelcomePage.kv")
Builder.load_file("./Pages/PatientHomePage.kv")
Builder.load_file("./Pages/DoctorHomePage.kv")
Builder.load_file("./Pages/NewUser_Doctor.kv")
Builder.load_file("./Pages/NewUser_Patient.kv")
Builder.load_file("./Pages/SymptomTracker.kv")
Builder.load_file("./Pages/FluidIntake.kv")
Builder.load_file("./Pages/PatientList.kv")
Builder.load_file("./Pages/BladderDiary.kv")

def sign_out_doctor(self):
    self.root.ids.Doctor_LogIn.log_out()
    self.root.current = 'Doctor_LogIn'

def sign_out_patient(self):
    self.root.ids.Patient_LogIn.log_out()
    self.root.current = 'Patient_LogIn'

def build(self): 
    from kivy.resources import resource_find

    filename = './Pages/Not_BladderDiary.kv'
    filename = resource_find(filename) or filename
    if filename in Builder.files:
        Builder.unload_file(filename)
    return Builder.load_file(filename)

MainApp().run()

Любая помощь будет оценена, спасибо!

Новый участник
user17258168 - новый участник этого сайта. Будьте внимательны, прося разъяснений, комментируя и отвечая. Ознакомьтесь с нашим Кодексом поведения .