Closing a Tkinter Entry Box in Python Closing a Tkinter Entry Box in Python tkinter tkinter

Closing a Tkinter Entry Box in Python


If I understand you correctly, then all you need to do is call the root window's destroy method at the end of the getName function:

def getName():    print ent.get()    root.destroy()

Doing so is equivalent to manually clicking the X button in the corner of the window.


Alternate method:


since there isn't much to your popup you could also eliminate several lines of code in your GUI, save some CPU and get pretty much the same output with this:

submitvariablename=raw_input('Please enter a Name')

same functionality and much faster, cleaner.

Just a thought.