删除Kivy的窗口边框 [英] Removing Kivy's Window border

查看:75
本文介绍了删除Kivy的窗口边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据kivy文档,我可以通过Window.borderless = True删除Window的边框 ( https://kivy.org/doc/stable/api-kivy .core.window.html )

According to the kivy document, I can remove Window's border by Window.borderless = True (https://kivy.org/doc/stable/api-kivy.core.window.html)

但是,问题是,启动时它仍然显示边框,然后在0.5秒内将其删除.对我来说似乎有点奇怪

However, The problem is, it still shows the border when it starts up, then it gets removed in like 0.5 second. And it seems a bit weird to me

是否可以在一开始就删除边框?

Is it possible to remove the border at the very beginning?

推荐答案

问题是由先读取Config并可能配置为border然后再读取您的配置引起的,因此在这种情况下,解决方案是将其保存在配置,因此应用程序的第二次加载将不再监视该过渡.

The problem is caused by first reading the Config and probably configured to be border and then read your configuration, so the solution in that case is to save it in the config, so a second load of the application will no longer watch that transition.

from kivy.app import App
from kivy.uix.widget import Widget
from kivy.core.window import Window
from kivy.config import Config

Config.read("myapp.ini")
if Config.getint('graphics', 'borderless') == 0:
    Config.set('graphics', 'borderless', '1')
    Config.write()
    Window.borderless = True


class MyApp(App):
    def build(self):
        return Widget()


if __name__ == '__main__':
    MyApp().run()

这篇关于删除Kivy的窗口边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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