[Tkinter-discuss] Problem facing in lift and tkraise urgent
klappnase at web.de
Sat Mar 21 19:44:20 CET 2009
On Sat, 21 Mar 2009 08:35:44 -0700 (PDT)
YMohan <yogendra_mohan at oxyent-medical.com> wrote:
> Hi All,
> I am facing the issues while using the lift or tkraise with create_window
> objects. its not working. I am trying to do the show one window at a time. I
> have created two window objects using the create_window and try to launch
> the first one. The following code I have written
> from Tkinter import *
> root = Tk()
> canvas = Canvas(root, width=300, height=300, bg='white') # 0,0 is top left
> canvas.pack(expand=YES, fill=BOTH) # increases down, right
> def setAbove():
> # print "after tk raise"
> widget1 = Frame(canvas, bg='red', height=100, width=100)
> widget2 = Frame(canvas, bg='blue', height=100, width=100)
> objectID1=canvas.create_window(100, 100, window=widget1) # embed a
> objectID2=canvas.create_window(100, 100, window=widget2) # embed a
> root.after(5000, setAbove)
> Let me know what am I doing wrong or any other way to do the same?
>From the canvas man page:
(...)the stacking order of window items is not affected by any of the canvas widget commands; you must use the raise and lower Tk commands instead.
So the solution is to call widget1.lift() instead of canvas.tkraise(objectID1).
> Thanks in advance.
> View this message in context: http://www.nabble.com/Problem-facing-in-lift-and-tkraise-urgent-tp22637232p22637232.html
> Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
More information about the Tkinter-discuss