How can i change kivy window position(我怎样才能改变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.top
和 Window.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窗口的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我怎样才能改变kivy窗口的位置


基础教程推荐
- 用于分类数据的跳跃记号标签 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- 筛选NumPy数组 2022-01-01