我真的可以用你的幫助來解決這個問題。我正在嘗試為幼兒的學習應用程式制作一種語音命令操作選單,而 kivy 讓我頭疼
如果按下按鈕但語音命令,我的所有螢屏都已正確定義并按預期加載,即使它們正確注冊并按預期保留其變數,當被要求對 ScreenManager 采取行動時,它們似乎沒有預期的效果if 陳述句被滿足
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
該變數Command.sel是從依賴項中捕獲的,定義為字串并正確攜帶,據我在除錯中的變數視圖中可以看出

然而,即使一切似乎都井井有條(實際上根本沒有出現錯誤訊息),當滿足 if 條件時,不會呼叫所需的螢屏
我在這里做錯了什么???
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!
uj5u.com熱心網友回復:
問題解決了
正確的命令是
self.parent.current = "your_screen_name"
答案(最終)在這里找到
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/440290.html
