Adding Icon To Tkinter Window - Followup

Serhiy Storchaka storchaka at gmail.com
Wed Mar 9 12:09:57 EST 2016


On 06.03.16 18:30, Wildman via Python-list wrote:
> That does not work...
>
> $ ./makexface.py
> Traceback (most recent call last):
>    File "./makexface.py", line 236, in <module>
>      root.wm_iconphoto(True, img)
>    File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1897, in __getattr__
>      return getattr(self.tk, attr)
> AttributeError: wm_iconphoto

This works in Python 3.x. In 2.7 you should use

     root.tk.call('wm', 'iconphoto', str(root), '-default', img, ...)

Note that it is worth to specify images for several different sizes (up 
to 128x128 for OS X).




More information about the Python-list mailing list