tkraise oddity

twd twd_gg at dockerz.net
Wed Aug 24 09:57:07 EDT 2005


I'm seeing some new and unexpected behaviour with tkinter + python2.4,
in a gnome+linux environment. The code below used to work (and
continues to work under windows). The intended behaviour is that a
window is created the the first time the button is pushed, and then
de-iconified and brought to the top whenever the button is pushed
again. The behaviour I'm seeing is that the window is de-iconified (if
iconified) correctly, but if already present on the screen, it is not
raised.

Does this code look ok? Any suggestions as to what the problem could
be?

Thanks for any pointers.

--------------------------------------------------
from Tkinter import *

t = None

def cmd():
    global t
    if t:
        t.tkraise()
        t.deiconify()
    else:
        t = Toplevel()
        l = Label( t, text=".... some text goes here ..." )
        l.pack()

b =  Button(text="Raise",command=cmd)
b.pack()
b.mainloop()




More information about the Python-list mailing list