Extra Tkinter GUI popup Extra Tkinter GUI popup tkinter tkinter

Extra Tkinter GUI popup


Every tkinter application needs exactly one instance of Tk class. In your code you don't create one but mainloop seem to create one automatically it's still created (See Bryan's comment below), even though you can't(easily) refer to it later.

If you will use additional Toplevel widgets to that of your curent one go:

root = tk.Tk()root.withdraw() # You can go root.iconify(), root.deiconify() later if you                # want to make this window visible again at some point.# MAIN CODE HEREroot.mainloop()

if not simply replace:

window = tk.Toplevel()

with:

window = tk.Tk()

Note: Also note that if you're working using IDLE keep in mind that it creates its own Tk object which may hide the fact that your application will need one when used standalone.


Remove Toplevel from window = tk.Toplevel(). I don't have a python2 dist available -- I'm on python3 but when I removed TopLevel from my code, it only brought up one window. So, the python3 way is....

import tkinter as tk#This creates the main window of an applicationwindow = tk.Tk()#Start the GUIwindow.mainloop()

I think the only difference would be that python2's tkinter is actually Tkinter (as you have already done).