[Tkinter/Win32] Message box on app start -> mouse is dead

Niels Diepeveen niels at endea.demon.nl
Tue Jan 18 17:02:16 EST 2000


Florian Weimer schreef:
> tk = Tk()
> Button(tk, text="Exit", command=sys.exit).pack()
> tkMessageBox.showinfo("Test app", "Click on Ok, then on Exit.\n"
>                       + "Do you see the problem?")
> tk.mainloop()
> 
> (The application doesn't respond to mouse clicks after dismissing the
> message box.)

Displaying a message box outside the main loop seems to mess up tk's
message dispatching somehow. One way to work around this is to use a
separate Tk instance and throw it away after displaying the message:
tk = Tk()
Button(tk, text="Exit", command=sys.exit).pack()
xxx = Tk()
xxx.withdraw()
tkMessageBox.showinfo("Test app", "Click on Ok, then on Exit.\n"
                      + "Do you still see the problem?", master=xxx)
xxx.destroy()
tk.mainloop()


-- 
Niels Diepeveen
Endea automatisering




More information about the Python-list mailing list