Skip to content Skip to sidebar Skip to footer

Can I Close Kivy Window And Open It Again?

Is there a way to launch kivy twice from the same process, while closing kivy's window when not needed? MWE: from kivy.app import App app = App () app.run () app.root_window.close

Solution 1:

I found this on the web. Add a method:

def reset():
    import kivy.core.window as window
    from kivy.base import EventLoop
    if not EventLoop.event_listeners:
        from kivy.cache import Cache
        window.Window = window.core_select_lib('window', window.window_impl, True)
        for cat in Cache._categories:
            Cache._objects[cat] = {}

Then you can restart the app like this:

from kivy.app import App
app = App ()
app.run ()
app.root_window.close ()
reset()
App().run ()

Post a Comment for "Can I Close Kivy Window And Open It Again?"