kivy: ScreenManager won't switch back to a screen it already switched to when using transition=FallOutTransition()

Versions

  • Python: 3.7.2
  • OS: Mac 10.14.4
  • Kivy: Tried with latest master and 1.10.1
  • Kivy installation method: pip

Description

I’m trying to switch back to a screen I’ve already switched to, but Kivy doesn’t update. I’ve tried a few different ways, the .current attribute gets set but my screen doesn’t update. I’ve tried updating it both from a thread and not from a thread and still no luck.

Code and Logs

I’ve tried all of these:

def reset_game():
     root.game_screen.manager.current = "player"
Clock.schedule_once(lambda _: reset_game(), 1)

root.game_screen.manager.current = "player"
 
App.get_running_app().p.current = "player"

I tried .switch_to() but get the normal error of:

File "/usr/local/lib/python3.7/site-packages/kivy/uix/screenmanager.py", line 984, in add_widget
     'Screen already managed by this ScreenManager (are you '
 kivy.uix.screenmanager.ScreenManagerException: Screen already managed by this ScreenManager (are you calling `switch_to` when you should be setting `current`?)

I was able to originally switch to this screen just fine, but now I want to switch back to it after being on a different screen that the same ScreenManager is managing.

I’m currently on the game_screen and would like to go back to the player_screen. I’ve also tried changing this from the player_screen’s manager; setting .current on player_screen.manager also didn’t work.

I’m testing my app by running python main.py from a venv where Kivy is installed.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (7 by maintainers)

Most upvoted comments

It’s closed-source right now because I can’t tell if I eventually want to put it on the app store or not 😬 . I’ll try the idea of deleting and re-adding the screen though to see if that fixes things. Thanks for working through this with me