Hi, On Thu, 19 Sep 2013 07:15:30 +0000 Vasilis Vlachoudis <vasilis.vlachou...@cern.ch> wrote:
> Hi all, > > I am trying to save on exit and restore on startup the placement of the > sash in the PanedWindow, with a code like this > > from Tkinter import * > > tk = Tk() > p = PanedWindow(tk, orient=HORIZONTAL, width=600) > p.pack(expand=YES,fill=BOTH) > f1 = Label(p, text="First", bg="Red") > p.add(f1) > f2 = Label(p, text="Second", bg="Green") > p.add(f2) > p.sash_place(0, 450, 0) # <----------------------- > tk.mainloop() > > The sash_place command is ignored. I believe because the window is not > created yet and the dimensions are zero. So if I place an > p.update_idletasks() before the sash_place, it works. > > Is there a more CLEAN to achieve the task. > > Is it recommended to use the update_idletasks before the mainloop? I think putting an update_idletasks() before the sash_place() is a perfectly "clean" way to handle issues like this. Personally I use this technique rather often, especially in cases when the geometry of a more complex gui layout causes ugly "flickering" effects when the window is created, update_idletasks() can work miracles :) And your example seems like a perfect indication for update_idletasks() either. Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. All your people must learn before you can reach for the stars. -- Kirk, "The Gamesters of Triskelion", stardate 3259.2 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org https://mail.python.org/mailman/listinfo/tkinter-discuss