问题描述
我刚刚下载了wxPython,并从运行了一些示例程序。但是,在使用wx。*的变量的每一行中,我得到一个导入错误中的未定义变量
I just downloaded wxPython, and was running some of the sample programs from here. However, on every line that uses a variable from wx.*, I get a "Undefined variable from import error"
例如,以下程序在行上生成五个错误1,4,8和两行5:
For example, the following program generates five errors on lines 1,4,8, and two on line 5:
import wx
class MyFrame(wx.Frame):
""" We simply derive a new class of Frame. """
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=title, size=(200,100))
self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)
self.Show(True)
app = wx.App(False)
frame = MyFrame(None, 'Small editor')
app.MainLoop()
然而,程序编译和运行完美。我没有对pydev或eclipse进行任何重大修改,并且wxPython安装很新鲜。
The program, however, compiles and runs perfectly. I haven't made any significant modifications to pydev or eclipse, and the wxPython install is fresh.
推荐答案
一些较新的版本的pydev (大约2010年1月) 很难跟踪导入的名称。这可能是没有的。
Some of the newer versions of pydev (circa January 2010) have a hard time tracking down imported names. It's probably nothing.
如果这是仍然发生,请将错误报告给 ,虽然毫无疑问他们已经知道了。
If this is still occurring, report the bug to appcelerator, though no doubt they already know about it.
我得到这个问题使用我刚刚下载的软件包,最终错误消失。我最近遇到的问题是下载pygame (大约2010年1月) 。
I get this problem when working with packages I've just recently downloaded, and eventually the errors go away. My most recent problem was after downloading pygame (circa January 2010).
修改
我已经修改了上面的答案,因为人们正在降级,我假设这是因为信息陈旧,或者因为appcelerator购买了aptana。我没有使用pydev与Eclipse近两年,现在情况可能会有所不同。
I've amended my answer above since people are downvoting it, and I'm assuming it's because the information is stale, or because appcelerator bought aptana. I have not used pydev with Eclipse for nearly 2 years and the situation may be different now.
这篇关于在pydev中使用wxPython时,未定义的导入变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!