Possible Duplicate:
Eclipse PyDev now shows all references to Tkinter as errors
我有一个非常简单的测试项目:
from Tkinter import *
win = Tk()
l = Label(win, text="Hello, TKInter")
l.pack()
win.mainloop()
它运行正常,但在 Eclipse 中,我收到以下两个错误:
Undefined variable: Label line 3
Undefined variable: Tk line 2
我是否做了一些事情来产生这些错误?如果没有,有没有办法强制 Eclipse 正确地重新评估这些行?
最佳答案
因为你导入*
。因此 Eclipse 不知道 Tk 和 Label 已导入。使用 from Tkinter import Tk, Label
代替。
关于python - 为什么 Eclipse 中的 Pydev 声称工作程序出现错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4839308/