我怎样才能改变kivy窗口的位置 [英] How can i change kivy window position

查看:38
本文介绍了我怎样才能改变kivy窗口的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有其他方法可以改变窗口位置而不使用:

from kivy.config import Config
Config.set('graphics', 'position', 'custom')
Config.set('graphics', 'left', 100)
Config.set('graphics', 'top',  100)

我不想使用这个,因为当我用我的属性更改最后一个参数 (100) 时,它不起作用.

I don't want to use this because when i change the last parameter (100) with my property it doesn't work.

推荐答案

可以使用当前具有 这个改变.

更新:当前的 Kivy 稳定版本可以实现 → 1.10.0.

Update: It's possible with the current Kivy stable version → 1.10.0.

有了它,您可以访问 Window.topWindow.left 属性并在运行时更改 Window 位置以及获取实际窗口的位置.如果没有该更改(例如版本 1.9.1),就无法做到这一点.

With that you can access the Window.top and Window.left properties and change Window position at runtime as well as get the actual position of the Window. Without that change (e.g. version 1.9.1), there's no way how to do that.

另外,Config 基本上是在应用程序实际运行之前进行 single 更改,例如将位置设置为 [0, 0],窗口将在 App().run() 之后显示在该位置.仅此而已.

Also, Config is basically for a single change before the application actually runs e.g. set the position to [0, 0] and the Window will display at that position after App().run(). Nothing more really.

这篇关于我怎样才能改变kivy窗口的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆