I have two .py logic file which assosiated with two different .kv template file. In the first logic I set the window config to:
Config.set('graphics', 'width', '720')
Config.set('graphics', 'height', '360')
Config.set('graphics', 'resizable', False)
Config.set('graphics', 'fullscreen', 'fake')
in short, in the last proccess of the first logic file. i destroy the kivy main loop with:
Clock.schedule_once(lambda dt: App.get_running_app().stop(), 0.1)
to go to the next line, which is the next logic file. I trying to make a new setting in the next logic file with:
Config.set('graphics', 'width', '920')
Config.set('graphics', 'height', '480')
Config.set('graphics', 'resizable', False)
but it seems the windows configuration follow the first config in the first logic file. Is there a way to remove the first configuration?
Since the only changes are the width and height of the window, an alternative is to use Window.size
, and you don't have to stop your Kivy App.
Replace
Config.set('graphics', 'width', '920')
Config.set('graphics', 'height', '480')
Config.set('graphics', 'resizable', False)
with
from kivy.core.window import Window
Window.size = (920, 480)
Place it just before invoking the second logic.
In order to avoid situations where the config settings do not work or are not applied before window creation (like setting an initial window size), Config.set should be used before importing any other Kivy modules. Ideally, this means setting them right at the start of your main.py script.