So I have read how to change the ICON on the window, however it seems to not be changing the icon when I run my program using Kivy and Python. Inside my python code there is something like this:
from kivy.core.window import Window
from kivy.config import Config
from kivy.app import App
Config.window_icon = "Desktop/X.jpg"
Lets say my picture is named X.jpg and has that right path. Is there another way to change that icon: The picture is attached to show what Icon I want to change.
I am using Python 2.7.x and Kivy 1.9.1 Thanks~
If you want your application to simply run things after the GUI has closed, the easiest and smallest approach would be to place any exit code after TestApp(). run() . run() creates a endless loop which also clears any event-data from within kivy so it doesn't hang.
The previous answer didn't work for me and I found another solution that did, so I wanted to share.
In build you can add:
self.icon = 'ico/path.ico'
According to the documentation - Application
Icon of your application. The icon can be located in the same directory as your main file. You can set this as follows:
class MyApp(App):
def build(self):
self.icon = 'myicon.png'
Changed in version 1.8.0: icon is now a StringProperty. Don’t set the icon in the class as previously stated in the documentation.
Note
For Kivy prior to 1.8.0, you need to set this as follows:
class MyApp(App):
icon = 'customicon.png'
Recommended 256x256 or 1024x1024? for GNU/Linux and Mac OSX 32x32 for Windows7 or less. <= 256x256 for windows 8 256x256 does work (on Windows 8 at least), but is scaled down and doesn’t look as good as a 32x32 icon.
Refering to:
https://kivy.org/docs/api-kivy.config.html
this should do it:
from kivy.config import Config
Config.set('kivy','window_icon','path/to/icon.ico')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With