I've been using easyGUI to build a GUI for my python script. I'm having trouble finding a way to change the taskbar icon.
I am also using pyinstaller to convert the python file to a exe and was able to change the exe's icon, but when I run the file the easyGUI blue feather appears in the taskbar. I've seen how you can change it in Tkinter, I know that easyGUI uses Tkinter, but how can I miniplate the taskbar icon while using easyGUI?
Icon customization is not supported currently with easyGUI. However, you can add support for this relatively easily.
Let's take a look at a random easyGUI object:
ChoiceBox. The source code for this very simple. (Find it in yourLib\site-packages\easygui\boxesfolder.) You can follow the same routine for any type of easyGUI window you're using. A bit lengthy, but it works.Let's add a new parameter to this, called icon.
We need to add it to the underlying class as well,
ChoiceBox.Next, in the ChoiceBox class, we do the same thing. Note how I added
iconto theGUItkobject's parameters.Here's the
GUItk __init__code. Add theiconparameter to this as well. We'll also finally call the actual method that will do the changing of icons for us.And finally, the
config_iconmethod, which you should also put right below theconfig_rootmethod.Add it to your code like this:
choicebox(choices=['choice1', 'choice2'], icon="pathto\icon.ico")And then if you compile this version of easyGUI into your pyinstaller, it should appear. (Remember the value of icon should be a string of a path pointing to an
.icofile. Also, note this has no error handling built in. If the path to your icon is wrong, then it won't catch that.) If you're trying to run it without pyinstaller, view this answer.Hope this was helpful! I know it's tedious, but it stays relatively consistent with the rest of the module.