Is it possible to change a Kivy app taskbar icon?

Viewed 681

I have a kivy app, here's the code:

class ComicNotificatorApp(App):

    def build(self):

        Window.size = (300, 300)
        self.title = 'Comics Notificator'
        self.icon = 'assets/icon.png'
        return Label(text=to_display)

and I'd like to change the taskbar icon of the app

this one here

and while I'm at it, how can I change the size of the window to automatically fit the size of the label, as opposed to setting it manually?

Thank you!

2 Answers

stackoverflow question <-- this link mention a similar question and I think this may help

kivy doc for your ref about kivy config object

and I only know how to change the window's icon but not the task bar one

...

class MyKivyApp(App):

    def build(self):
        self.title = 'window's title'
        self.icon = <icon>: str  <----

...

the taskbar one maybe you can change it when packaging

how can I change the size of the window to automatically fit the size of the label

maybe you can try to use the kivy.config.Config.set() , if I get it correctly , you want to set the size of the window == size of label ? if so then set the size of the label first, then use kivy.config.Config.set('graphics', 'width', <size>: str) kivy.config.Config.set('graphics', 'height', <size>: str)

# I assume you won't change the label size after starting the kivy screen 
import kivy
kivy.config.Config.set('graphics', 'width', <label_width>: str)
kivy.config.Config.set('graphics', 'width', <label_height>: str)

...

because the config have to set at the very beginning , before the kivy window is created e.g.

import kivy
# set config here
# import another stuff

hope this help : )

A bit late but for your main question Is it possible to change a kivy app taskbar icon, no it isn't possible to change the taskbar icon if you are running the app as a script, not an executable of some kind. However, the taskbar icon will automatically sync with your window icon when run as an executable(by packaging your app using pyinstaller or py2exe, anything like that could work)

Related