'i can't change screen kivy

how can i change screen when i click to any button in my main screen for example in may program (bad 01: imene, bad 02: kamel, ...) to screen name "value_secreen" i m using kivy and python and this is all my py and kv file

main.py

from kivy.app import App
from kivy.uix.screenmanager import ScreenManager


class HealthInterfaceManagerLayout(ScreenManager):
    pass


class HealthInterfaceManagerApp(App):
    pass


HealthInterfaceManagerApp().run()

healthinterfacemanager.kv

#:import stacklayout_interface stacklayout_interface

HealthInterfaceManagerLayout:
<HealthInterfaceManagerLayout>:
    Screen:
        name: "main_secreen"
        StackLayoutInterface:
    Screen:
        name: "value_secreen"
        Button:
            text: "Button From value_secreen"

stacklayout_interface.py

from kivy.lang import Builder
from kivy.metrics import dp
from kivy.uix.button import Button
from kivy.uix.stacklayout import StackLayout


Builder.load_file("stacklayout_interface.kv")

hospital_bads = {"bad_01": {"heart_rate": [],
                            "blood_pressure": [],
                            "o2_saturation": [],
                            "respiration_rate": [],
                            "name": "imene"
                            },
                 "bad_02": {"heart_rate": [],
                            "blood_pressure": [],
                            "o2_saturation": [],
                            "respiration_rate": [],
                            "name": "kamel"
                            },
                 "bad_03": {"heart_rate": [],
                            "blood_pressure": [],
                            "o2_saturation": [],
                            "respiration_rate": [],
                            "name": "omar"
                            },
                 "bad_04": {"heart_rate": [],
                            "blood_pressure": [],
                            "o2_saturation": [],
                            "respiration_rate": [],
                            "name": "amina"
                            }
                 }


class StackLayoutInterface(StackLayout):

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        self.orientation = 'lr-tb'

        for i in range(len(hospital_bads)):
            bad_num = f"bad {(list(hospital_bads.keys())[i]).split('_')[1]}"
            bad_name = hospital_bads[list(hospital_bads.keys())[i]]['name']
            b = Button(text=f"{bad_num}: {bad_name}",
                       size_hint=(None, None),
                       size=(dp(240), dp(60)))
            self.add_widget(b)

stacklayout_interface.kv

<StackLayoutInterface>:

help plz



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source