简体   繁体   English

如何使用 Window.top 和 Window.left 更改 kivy 窗口位置

[英]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.left 和 Window.top

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

I don't know the syntax or my kivy installation is bugged我不知道语法或我的 kivy 安装被窃听

Person in chat @inclement did not understand this question... so here is full example:聊天@inclement 中的人不明白这个问题......所以这里是完整的例子:

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();

Found out the answer i had problems with my code rather than syntax or installation of Kivy.找到了答案,我的代码有问题,而不是 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.对@inclement 的反馈:如果你按照你的想法去做,那么你的钱是对的。 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 =)你问我额外的问题比帮助更令人困惑,帮助的意图不减=)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM