Tkinter: modal ok in windows, but not in Linux

DoubleM mmoum at woh.rr.com
Wed Jan 14 19:13:33 EST 2004


Hi,

I'm running Python2.3.3c1 on Mandrake 9.1

The following code is designed to bring up a window with a button labeled
"popup".  Clicking on the popup buttons triggers a secondary window with a
button labeled "ok".  The second window is supposed to be modal - it should
not be possible to reset the focus back to the first window or close the
first window without first closing the second.  The program works just fine
in Windows XP home, but in Linux I can close the first window while the
second one is still active.

This seems to be a bug, or am I doing something wrong.  I searched google
for Tkinter Linux modal, but found nothing relevant.

Thanks for your help.

Here's the code, copied and pasted from IDLE.

#############################
from Tkinter import *

makemodal = 1

def dialog():
    win = Toplevel()
    Label(win, text = "Secondary").pack()
    Button(win, text = "Ok", command = win.destroy).pack()
    if makemodal:
        win.focus_set()
        win.grab_set()
        win.wait_window()
    print "dialog exit"

root = Tk()
Button(root, text = 'popup', command = dialog).pack()
root.mainloop()
#################################

Mike
mmoum-xxxspam.woh.rr.com
-- 
Remove -xxxspam to reply




More information about the Python-list mailing list