[Tkinter-discuss] Problem facing in lift and tkraise urgent

YMohan yogendra_mohan at oxyent-medical.com
Sat Mar 21 21:08:03 CET 2009


Hello Michael,

Thanks a lot for immediate reply.
Your solution works.

Regards
Yogendra Mohan


Michael Lange wrote:
> 
> 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
>> corner
>> canvas.pack(expand=YES, fill=BOTH)                   # increases down,
>> right
>> 
>> def setAbove():
>>     canvas.tkraise(objectID1)
>> #    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
>> widget
>> objectID2=canvas.create_window(100, 100, window=widget2)        # embed a
>> widget
>> root.after(5000, setAbove)
>> root.mainloop()
>> 
>> 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).
> 
> HTH
> 
> Michael
> 
> 
>> Thanks in advance.
>> 
>> YMohan
>> 
>> -- 
>> 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
>> http://mail.python.org/mailman/listinfo/tkinter-discuss
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-facing-in-lift-and-tkraise-urgent-tp22637232p22639838.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.



More information about the Tkinter-discuss mailing list