+ -
当前位置:首页 → 问答吧 → 关于wx模块到底要怎么才能导进去啊

关于wx模块到底要怎么才能导进去啊

时间:2011-03-29

来源:互联网

#encoding=utf-8

import wx
class MyFrame(wx.Frame):
    def __init__(self,parent):
        wx.Frame.__init__(self,parent,-1,'hello world',size=(300,300))
        panel=wx.Panel(self)
        sizer=wx.BoxSizer(size)

        txt=wx.StaticText(panel,-1,'hello world')
        sizer.Add(txt,0,wx.TOP|wx.LEFT,100)

        self.Centre()
app=wx.App()
frame=MyFrame(None)
frame.show(True)

app.mainloop()

打印提示:
Traceback (most recent call last):
  File "C:\Python26\shijian\wx.py", line 3, in <module>
    import wx
  File "C:\Python26\shijian\wx.py", line 4, in <module>
    class MyFrame(wx.Frame):
AttributeError: 'module' object has no attribute 'Frame'

到底是wx没导入成功吗,之前的win32com.client也是。我py版本是2.6。
新人求帮助啊。学到这里就学不起走了。

作者: hdc370015   发布时间: 2011-03-29

换个文件名就可以了,sys.path默认第一个是当前目录下,你import的wx模块是自己

作者: 3227049   发布时间: 2011-03-29