Home > database >  kivy switch_to screen on if statement doesn't work
kivy switch_to screen on if statement doesn't work

Time:03-09

I could REALLY use your help with this one. I'm trying to make a sort-of voice command operated menu for a toddler's learning app and kivy is giving me a headache

all of my screens are correctly defined and load as intended if the buttons are pressed but the voice commands, even though they register correctly and carry over their variables as intended they don't seem to have the desired effect when asked to act upon ScreenManager when the if statement is fulfilled

        def on_enter(self):
        ....
        Command.start()
        Command.introMenu()
        ......
            if Command.sel == "shapes":
                ScreenManager().switch_to = "shapes"
            elif Command.sel == "colours":
                ScreenManager().switch_to = "colours"
            ......
            else:
                pass

the variable Command.sel is captured from a dependency, defined as a string and carried correctly as far as I can tell from the variables view in debugging

variables

yet even though everything seems to be in order (in fact no error messages appear at all) the desired screen is not called when the if condition is met

what am I doing wrong here???

full code here (please ignore the Greek bits in the code... it's just strings, imagine it's any other language for that matter...)

thank you!

CodePudding user response:

issue resolved

correct command was

self.parent.current = "your_screen_name"

answer (eventually) found here

  • Related