Removing Kivy's Window border

雨燕双飞 提交于 2021-02-11 01:58:30

问题


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)

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?


回答1:


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()


来源:https://stackoverflow.com/questions/52397887/removing-kivys-window-border

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!