问题
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