2

I want to set my own icon in my kivy app, but its not working. I have tried both with icon.ico and icon.png.

This is what i have tried:

class MyApp(App):
    def build(self):
        self.icon = 'myicon.png'

and:

from kivy.config import Config
Config.set('kivy','window_icon','icon.ico')
Nick
  • 57
  • 1
  • 7
  • What do you mean by 'icon'? Where do you want the image to be displayed? – inclement Aug 19 '19 at 19:23
  • https://stackoverflow.com/questions/40666323/how-to-change-the-icon-on-the-window-when-i-run-my-program-in-kivy If you look at this question, you will see a image of where i want the icon. (There is no icon on mac by the way, so i am using Windows) – Nick Aug 19 '19 at 19:28
  • What do you mean by not working? Does the logo not show or an error pops up? – Nouman Aug 20 '19 at 05:29
  • There's an outstanding bug for this which may be why you're having issues github.com/kivy/kivy/issues/2202 – Michael Altfield Sep 27 '20 at 15:53

1 Answers1

2

Your icon path needs to be either absolute or relative to your application file. So if your directory structure looks like this:

my_app/
├── app.py
└── things
    └── images
        └── my_icon.png

Then you're going to need

class MyApp:
    def build(self):
        self.icon = r'C:\Users\you\path\to\my_app\things\images\my_icon.png'

Obviously you'll want to replace that with the actual path. You should also be able to have

        self.icon = r'things\images\my_icon.png'

but I'm not sure about that.

Wayne Werner
  • 49,299
  • 29
  • 200
  • 290