Possible Win32 Tkinter bug?
Tim Daneliuk
tundra at tundraware.com
Fri Nov 15 17:30:07 EST 2002
David LeBlanc wrote:
> It sounds to me as though you don't have the right modality set for the
> message box or something is messed up about your tkinter installation.
>
> Windows has 3 dialog modalities:
>
> application modal - the dialog gets the focus, the main app is disabled and
> control returns to the app when the dialog is dismissed. IIRC, this is what
> a tkMessageBox is by default and there's no option to change the modality.
> system modal - the dialog gets the focus, all apps are disabled and control
This is my understanding as well. However, I also found this at
http://mini.net/tcl/MessagBox from Harald Oehlmann:
On windows the tk_messageBox command sets the toplevel . to the top of
the window stacking order. After the message box the toplevel . gets the
focus.
To "repair" this behavior on tcl8.4 one can protect the windows over .
by wm attributes -topmost 1 and save the focus over the routine.
# tk_messageBox for Windows which keeps focus and stacking order
proc messageBox args {
# > Save focus
set Focus [focus]
# > Get the toplevels above . and set topmost attribute
set lWindows [wm stackorder .]
set TopPos [lsearch $lWindows .]
if {-1 != $TopPos && $TopPos != [llength $lWindows]} {
incr TopPos
set lWindows [lrange $lWindows $TopPos end]
foreach Wi $lWindows {
wm attributes $Wi -topmost 1
}
} else {
unset lWindows
}
}
...
I'm still trying to figure out the corresponding Python (I've never really
done anything in tcl), but this seems to explain the behavior I am
seeing, no?
--
------------------------------------------------------------------------------
Tim Daneliuk
tundra at tundraware.com
More information about the Python-list
mailing list