Python and tkinter: NameError: name 'askyesno' is not defined
Python and tkinter: NameError: name 'askyesno' is not defined
我收到这个错误:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python36-32\lib\tkinter\__init__.py", line 1699, in __call__ return self.func(*args)
File "C:\Users\Administrator\Desktop\Base\utility.py", line 68, in clear
askyesno('Clear', 'Press YES or NO')
NameError: name 'askyesno' is not defined
当我尝试 运行 时:
if askyesno('Clear', 'Press YES or NO'):
do some code
我已经尝试 tkMessageBox.askyesno
但仍然出现错误。
试试这个 from tkinter import messagebox
导入 messagebox
然后:
if messagebox.askyesno('Clear', 'Press YES or NO'):
我收到这个错误:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python36-32\lib\tkinter\__init__.py", line 1699, in __call__ return self.func(*args)
File "C:\Users\Administrator\Desktop\Base\utility.py", line 68, in clear
askyesno('Clear', 'Press YES or NO')
NameError: name 'askyesno' is not defined
当我尝试 运行 时:
if askyesno('Clear', 'Press YES or NO'):
do some code
我已经尝试 tkMessageBox.askyesno
但仍然出现错误。
试试这个 from tkinter import messagebox
导入 messagebox
然后:
if messagebox.askyesno('Clear', 'Press YES or NO'):