Max Phillips
Max Phillips

Reputation: 7489

Kivy app window always opens half off the screen

How do I set the window to open as expected in the top left corner of the desktop?

from kivy.config import Config
Config.set('graphics', 'resizable', '0')
Config.set('graphics', 'top', '0') ### This doesn't seem to do anything
Config.set('graphics', 'left', '0') ### This doesn't seem to do anything
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.behaviors import ButtonBehavior
from kivy.uix.image import Image
from kivy.core.window import Window
from kivy.uix.button import Button

Window.size = (1200, 800)

class ImageButton(ButtonBehavior, Image):
    pass

class ContainerView(FloatLayout):   
    pass

class ScoreboardApp(App):

    def build(self):
        cView = ContainerView()
        return cView

enter image description here

Upvotes: 0

Views: 1027

Answers (1)

Peter Badida
Peter Badida

Reputation: 12179

There is a one more line required:

Config.set('graphics', 'position', 'custom')

which is a little bit above top and under left.

If auto is used, you have no control of the initial position: top and left are ignored.

and as it's mentioned in the docs, it actually is auto by default, so your settings are ignored. Setting it to custom solves your problem. :)

Upvotes: 1

Related Questions