Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I hide the main window titlebar and place a transparent background in kivy framework?

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.

Does anyone know how to do this?

Thanks

like image 224
Alexandru Sima Avatar asked Dec 20 '22 20:12

Alexandru Sima


2 Answers

There is a simpler way:

from kivy.app import App
from kivy.core.window import Window

class MyApp(App):
    def build(self):
        Window.borderless = True

# ...

http://kivy.org/docs/api-kivy.core.window.html#kivy.core.window.WindowBase.borderless

like image 84
cessor Avatar answered Dec 22 '22 08:12

cessor


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

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.

like image 34
Nykakin Avatar answered Dec 22 '22 09:12

Nykakin