Python 3.6 tkinter window icon on Linux error -


i studying python gui python gui programming cookbook. task requires me change window icon adding following code recipe:

# change main windows icon win.iconbitmap(r'c:\python34\dlls\pyc.ico') 

since using linux, have change path /home/user/test.ico. after reading similar questions, got know .ico windows only. tried .gif doesn't work either. existing articles tried: tkinter tclerror: error reading bitmap file setting application icon in python tk base application (on ubuntu) tkinter.tclerror: image "pyimage3" doesn't exist

all 3 of these unhelpful. got following error each:

in [3]: runfile('/home/bhedia/untitled1.py', wdir='/home/bhedia') traceback (most recent call last):    file "<ipython-input-3-17a671578909>", line 1, in <module>     runfile('/home/bhedia/untitled1.py', wdir='/home/bhedia')    file "/home/bhedia/anaconda3/envs/mitx/lib/python3.5/site-packages/spyder/utils/site/sitecustomize.py", line 880, in runfile     execfile(filename, namespace)    file "/home/bhedia/anaconda3/envs/mitx/lib/python3.5/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile     exec(compile(f.read(), filename, 'exec'), namespace)    file "/home/bhedia/untitled1.py", line 58, in <module>     img = tk.photoimage(file='test.ico')    file "/home/bhedia/anaconda3/envs/mitx/lib/python3.5/tkinter/__init__.py", line 3403, in __init__     image.__init__(self, 'photo', name, cnf, master, **kw)    file "/home/bhedia/anaconda3/envs/mitx/lib/python3.5/tkinter/__init__.py", line 3359, in __init__     self.tk.call(('image', 'create', imgtype, name,) + options)  tclerror: couldn't recognize data in image file "test.ico"  in [4]: runfile('/home/bhedia/untitled1.py', wdir='/home/bhedia') traceback (most recent call last):    file "<ipython-input-4-17a671578909>", line 1, in <module>     runfile('/home/bhedia/untitled1.py', wdir='/home/bhedia')    file "/home/bhedia/anaconda3/envs/mitx/lib/python3.5/site-packages/spyder/utils/site/sitecustomize.py", line 880, in runfile     execfile(filename, namespace)    file "/home/bhedia/anaconda3/envs/mitx/lib/python3.5/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile     exec(compile(f.read(), filename, 'exec'), namespace)    file "/home/bhedia/untitled1.py", line 59, in <module>     root.tk.call('wm','iconphoto',root._w,img)  tclerror: can't use "pyimage2" iconphoto: not photo image 

so, not sure how change window's icon when using tkinter library on linux.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -