[Tkinter/Win32] Message box on app start -> mouse is dead
Florian Weimer
someone at deneb.cygnus.argh.org
Sat Jan 22 12:24:08 EST 2000
Niels Diepeveen <niels at endea.demon.nl> writes:
> 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()
Another possibilty (which I actually use): Calling the initialization
code from the main loop (using Tk.after_idle).
More information about the Python-list
mailing list