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窗口的位置


基础教程推荐
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- 对多索引数据帧的列进行排序 2022-01-01
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01
- 在 Python 中将货币解析为数字 2022-01-01
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- Kivy 使用 opencv.调整图像大小 2022-01-01
- matplotlib 设置 yaxis 标签大小 2022-01-01