[Tkinter-discuss] Windows beautification

Michael Lange klappnase at web.de
Wed Nov 22 21:50:37 CET 2006


On Wed, 22 Nov 2006 11:33:05 -0800 (PST)
Sorin Schwimmer <sxn02 at yahoo.com> wrote:

> Hi All,
> 
> 1. I'd like to be able to put an icon on the titlebar. I read about using iconwindow together
> with a Label, but how? My code:
> 
> from Tkinter import *
> import Image,ImageTk
> 
> root=Tk()
> im=ImageTk.PhotoImage(Image.open("mcut16.png")) # a 16x16 image
> lb=Label(root,image=im)
> root.iconwindow(lb)
> 
> yields the following error:
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/local/lib/python2.4/lib-tk/Tkinter.py", line 1473, in wm_iconwindow
>     return self.tk.call('wm', 'iconwindow', self._w, pathName)
> _tkinter.TclError: can't use .-1211821748 as icon window: not at top level
> 
> How should I do it?
> 

I think you need a Toplevel() window instead of a Label.

Michael


More information about the Tkinter-discuss mailing list