的工作,我有一些代码,这里简化它,但该事件将无法正常工作,我可以请得到一些帮助不event.wiget.pack_forget()中的Tkinter
from tkinter import *
root = Tk()
def Delete():
event.wiget.pack_forget()
db = Button(root, text = "delete", command = Delete)
db.pack()
错误代码如下
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.5/idlelib/run.py", line 119, in main
seq, request = rpc.request_queue.get(block=True, timeout=0.05)
File "/usr/lib/python3.5/queue.py", line 172, in get
raise Empty
queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.5/tkinter/__init__.py", line 1550, in __call__
return self.func(*args)
File "/home/travis/trying to delete stuff.py", line 4, in Delete
event.wiget.pack_forget()
NameError: name 'event' is not defined
由于事先
当你运行该代码会发生什么?我猜你会得到一个错误。请发布完整的错误。它告诉你到底是什么问题。 –
您试图“忘记”哪个小工具? – CommonSense
按钮,db。使用删除功能的那个。 - CommonSense – Travis