如何在Kivy中放置无边界窗口 [英] How to position a borderless window in Kivy
问题描述
我当时正在用python用Kivy制作一个应用程序,为了使事情变得更时尚,我想我可以删除窗口上的边框并自己创建:
I was making an app with Kivy in python, and to make things a tad more stylish, I thought I could remove the border on the window and create by own:
from kivy.config import Config
from kivy.core.window import Window
Window.size = (900,550)
Window.borderless = True
Config.set('graphics','resizable',0)
但是,无边框窗口将在屏幕的左下角弹出.无论如何,我可以将窗口放置在屏幕中间吗?
However the border less window will pop up in the very bottom left corner of my screen. Is there anyway I can position the window so its in the middle of my screen?
如果我做不到,那么有没有办法去除窗户上的圆角?
If I can't do that, then is there a way to remove the rounded corners on a window?
(我正在Mac OSX Yosemite上执行此操作)
(I am doing this on a Mac OSX Yosemite)
推荐答案
无边界:
from kivy.config import Config
Config.set('graphics','borderless',1)
Config.set('graphics','resizable',0)
位于文件顶部.只是核心(窗口)将保留.
at the top of your file before anything else. Just the core(Window) will remain.
位置:
Config.set('graphics','position','custom')
Config.set('graphics','left',500)
Config.set('graphics','top',10)
相同的条件适用于所有 Config.set()
.
the same condition applies for all Config.set()
.
这篇关于如何在Kivy中放置无边界窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!