Reputation: 103
I'm trying to repositon the window since
Window.size=(window_width,window_height)
takes the standard position of any Kivy app und so my program does not fit on the screen. I've tried
from kivy.config import Config
Config.set('graphics', 'position', 'custom')
Config.set('graphics', 'left', 0)
Config.set('graphics', 'top', 0)
at the beginning of my source, at the
__main__
and in the build method of the app. Nothing seems to work. The same goes for setting the size with the config and possibly everything else with the Config
Upvotes: 1
Views: 4682
Reputation: 103
I've found the Problem by reading in the API of the Kivy Configuration Object. You need to set it at the very start or other imports can override the config!
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.
Upvotes: 1
Reputation: 12199
You can approach it either your way and somehow find out system screen size
from kivy.config import Config
# topleft, size (50, 50)
Config.set('graphics', 'position', 'custom')
Config.set('graphics', 'left', 0)
Config.set('graphics', 'top', 0)
from kivy.core.window import Window
Window.size = (50, 50) # input system window size
OR, you can set the Window to be fullscreen directly:
from kivy.config import Config
Config.set('graphics', 'fullscreen', 1)
from kivy.app import runTouchApp
from kivy.uix.button import Button
runTouchApp(Button())
Upvotes: 1