問題描述
我有一個小問題,我正在開發一個使用 python kivy gui 框架的小應用程序.我想要的只是隱藏主窗口的標題欄并使背景顏色透明.我在網上搜索了很多,但找不到解決方案.
I have a small problem and I am working on a small app that uses the python kivy gui framework. All i want is to hide the titlebar of the main window and make the background color transparent. I searched the net intensively but I couldn't find a solution for this.
有人知道怎么做嗎?
謝謝
推薦答案
您可以使用 kivy.config.Config
禁用 bar.將fullscreen
設置為fake
:
You can disable bar using kivy.config.Config
. Set fullscreen
as fake
:
from kivy.config import Config
Config.set('graphics', 'fullscreen', 'fake')
from kivy.app import App
from kivy.uix.button import Button
class MyApp(App):
def build(self):
button = Button(text="Exit", size_hint=(None, None))
button.bind(on_press=exit)
return button
if __name__ == '__main__':
MyApp().run()
您可以在此處找到更多配置選項:http://kivy.org/docs/api-kivy.config.html#available-configuration-tokens 例如,還要改變窗口的位置:
You can find more configuration options here: http://kivy.org/docs/api-kivy.config.html#available-configuration-tokens For example, to also change position of window:
from kivy.config import Config
Config.set('graphics', 'fullscreen', 'fake')
Config.set('graphics', 'position', 'custom')
Config.set('graphics', 'top', '300')
Config.set('graphics', 'left', '300')
from kivy.app import App
from kivy.uix.button import Button
class MyApp(App):
def build(self):
button = Button(text="Exit", size_hint=(None, None))
button.bind(on_press=exit)
return button
if __name__ == '__main__':
MyApp().run()
很遺憾,我不知道是否可以添加透明度.
Unfortunately, I don't know whether it's possible to add transparency.
這篇關于如何隱藏主窗口標題欄并在 kivy 框架中放置透明背景?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!