tkinter window geometry
Eric Brunel
eric.brunel at N0SP4M.com
Mon Nov 24 04:17:17 EST 2003
More information about the Python-list mailing list
Mon Nov 24 04:17:17 EST 2003
- Previous message (by thread): tkinter window geometry
- Next message (by thread): Best method for an NT service and python to interact?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Zora Honey wrote: > > I realized after I posted that the window manager would be important. > I'm on RedHat 7.1, KDE 3.0. > > Neither the switch to getting the geometry through the geometry call or > doing an update_idletasks (which I had tried before posting) works on > their own, but together they seem to be working. Apparently I just > didn't hit on the right combination. > > Now, if someone can tell me how I can get this to work on a Toplevel > without having the window manager flash the "default" geometry and then > redrawing it with my specified geometry, I would be a very happy camper. This will be more trouble... You can try to do a root.withdraw() just after creating the root window and a root.deiconify() just before running the mainloop, but it seems it messes up things a bit: if I do that, closing the window and re-running the script opens the window a bit too low and a bit too right. So doing many close/run in succession makes the window go slowly towards the bottom right corner. Apparently, some window decorations from the window manager are not taken into account by the geometry method when the window is withdrawn. Too bad... If anybody has a solution for this, I'll be glad to hear it too. > P.S. To Eric Brunel--thanks for your other fixes. The "real" code does > check for a file and specify an exception--this was just a copy pared > down enough for posting :) I will take the root.quit() under > advisement. Can you explain why it is "better" than just exiting the > process? First, it certainly leaves things more cleanly on the tcl/tk level than a "violent" sys.exit. Second, it allows you to put some clean-up code behind your root.mainloop() call. This code will then always be executed if you do a root.quit(); it won't if you do a sys.exit(). You can actually achieve the same goal by putting a try/finally around your main script, but quitting the main window is the normal way to close a Tkinter application. HTH -- - Eric Brunel <eric dot brunel at pragmadev dot com> - PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
- Previous message (by thread): tkinter window geometry
- Next message (by thread): Best method for an NT service and python to interact?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list