eric.brunel at pragmadev.com
Mon Oct 21 10:02:00 CEST 2002
> Every now and again I get it in my head that some new project would be
> done in Tkinter. Every time I find myself struggling horribly. I have
> Grayson book, I have a Fredrik Lundh pdf book from '99. Somewhere,
> something doesn't click. So, along with the specific questions, I am also
> looking for a Tkinter moment of clarity.
> Currently, I am trying to put together a project with a base window, and
> dialog. The base window is for most work, but the dialog pops up for
> certain editing of parameters, etc. The parts which I am having trouble
> with are (a) making the dialog modal (only one can exist, and the root
> window can't be reached until the dialog is closed), and (b) I would like
> to return
> data from the dialog to the root window. Neither of these seem like they
> should be terribly difficult, yet they elude me.
First of all, if I understood correctly, there's no "standard" way with
tk/Tkinter to make a window modal in itself; it's the caller that decides
if the window should be modal or not.
So here is the way I do things whenever I want to make a modal window:
dlg = MyDialogClass(...) # Always a sub-class of Toplevel
What prevents the root window to be reactive is the "transient" stuff. The
explanation of this method can be found in the tk man pages @
http://www.tcl.tk/man/tcl8.3/TkCmd/contents.html (the site appears to be
broken for now, so I can't tell you the actual entry).
- Eric Brunel <eric.brunel at pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
More information about the Python-list