Does anyone know why Python\'s 2.7 Spyder is successfully initializing the \'Hello World\' Kivy app just once, i.e. hitting F5 brings the window app, but when I close it and
Refer to the webpage: https://groups.google.com/forum/m/#!topic/kivy-users/yfhH7skAEJA, it gave a solution for fixing this issue, I rewrite the code as below,
from kivy.app import App
from kivy.uix.button import Button
class TestApp(App):
def build(self):
return Button(text='Hello World')
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)
Cache.print_usage()
for cat in Cache._categories:
Cache._objects[cat] = {}
if __name__ == '__main__':
reset()
TestApp().run()
The reset() function will clean up the Window's state and run the TestApp() normally.