tkinter askstring deleted before its visibility changed

python-3.x, simpledialog, string, tkinter, tkinter-entry

Solution

I know this is an old thread, but I'm having the same problem and so far haven't found the root cause.

However, this workaround works for me in case anyone else needs it:

#Create a new temporary "parent"

newWin = Tk()

#But make it invisible

newWin.withdraw()

#Now this works without throwing an exception:

retVal = simpledialog.askstring("Enter Value","Please enter a value",parent=newWin)

#Destroy the temporary "parent"

newWin.destroy()

Problem

I am trying to make a popup window where someone can fill in a string in an Entry box. I have gone through many examples, but it doesn't work. I am trying to this: ``` var_entry = simpledialog.askstring("Test", "Test") ``` I get this error message: ``` _tkinter.TclError: window ".!_querystring" was deleted before its visibility changed ``` Thanks in advance! edit: posted wrong error message

Original source