马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 LYF511 于 2019-3-27 19:11 编辑
咋回事呀?
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 1702, in __call__
return self.func(*args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\program\tool.py", line 36, in explorer
button = tk.Button(frame, text="确定", command=Yes)
UnboundLocalError: local variable 'Yes' referenced before assignment
相关代码:def explorer(self):
root = tk.Tk()
frame = tk.Frame(root)
frame.pack()
e = tk.Entry(root)
e.pack(padx=20, pady=20)
button = tk.Button(frame, text="确定", command=Yes)
button.pack()
def Yes():
os.startfile(e.get())
root.geometry()
root.title("请输入路径:")
mainloop()
UnboundLocalError: local variable 'Yes' referenced before assignment
未绑定本地变量错误:本地变量“yes”在赋值之前被调用。
|