Ggjustice V
Ggjustice V

Reputation: 97

How can i change kivy window position using Window.top and Window.left

Someone questioned similar thing , answer was given but without example for it thus i am unable to solve this simple solution checked documentation and was unable to understand

from kivy.core.window import Window

How to do this :

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

Config.set('graphics','left',500)
Config.set('graphics','top',10)

using Window.left and Window.top

Window.size = (1920, 150)
Window.top =????????
Window.left =??????????

I don't know the syntax or my kivy installation is bugged

Person in chat @inclement did not understand this question... so here is full example:

from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
import threading
from kivy.core.window import Window

class Hello(FloatLayout):
    
    def __init__(self,**kwargs):
        threading.Thread.__init__(self)
        super(Hello,self).__init__(**kwargs)       
        Window.size = (600, 150)
        #INSERT Window.left and under it Window.top to position this window on coordinates 50,50 on the top left of the screen
        

class Example(App):
    def build(self):
        return Hello()

if __name__ == '__main__':
    Example().run();

Upvotes: 1

Views: 3196

Answers (1)

Ggjustice V
Ggjustice V

Reputation: 97

Found out the answer i had problems with my code rather than syntax or installation of Kivy.

Answer to above example is simply inserting:

Window.top = 50
Window.left = 50

I had problems somewhere else in my code so i was very confused and wanted quick check with someone.

Feedback for @inclement: if you went with your thought answer is you were right on the money. That was the syntax and what i was looking for. You asking me additional questions was more confusing than helpful, intention of helping appreciated non the less =)

Upvotes: 5

Related Questions