[SOLVED] kivy switch_to screen on if statement doesn't work


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):
            if Command.sel == "shapes":
                ScreenManager().switch_to = "shapes"
            elif Command.sel == "colours":
                ScreenManager().switch_to = "colours"

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


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!


issue resolved

correct command was

self.parent.current = "your_screen_name"

answer (eventually) found here

Answered By – Giorgos_Vr

Answer Checked By – David Goodson (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *