Max*_*ing 4 string tkinter python-3.x simpledialog tkinter-entry
我正在尝试制作一个弹出窗口,人们可以在其中填写输入框中的字符串。我已经经历了很多例子,但它不起作用。
我正在尝试这样做:
    var_entry = simpledialog.askstring("Test", "Test")
我收到此错误消息:
_tkinter.TclError: window ".!_querystring" was deleted before its visibility changed
提前致谢!
编辑:发布错误的错误消息
我知道这是一个旧线程,但我遇到了同样的问题,到目前为止还没有找到根本原因。
但是,如果其他人需要它,此解决方法对我有用:
#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()
| 归档时间: | 
 | 
| 查看次数: | 2354 次 | 
| 最近记录: |