WxPython AttributeError: module does not have the 'Frame' attribute

I am trying to learn wxPython and when I follow the tutorial to learn it. I am facing some errors. I did a lot of research and cannot find anything on this site as far as my situation is concerned, and I also installed and tried all different versions of wxpython for python 2.7, there is still no difference. I'm on a Dell Windows 8 64-bit machine. Here is the code from the tutorial:

import wx class MyFrame(wx.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() 

and error:

 Traceback (most recent call last): File "C:\Python27\test", line 2, in <module> class MyFrame(wx.Frame): AttributeError: 'module' object has no attribute 'Frame' 
+4
source share
2 answers

You have a local wx.py file in the same directory. Python imports this file instead of the wx package.

Delete or rename this file.

+4
source

I think you might have installed wx using pip. You can try installing wx by running the executable from the home page. I tried and it worked.

+1
source

Source: https://habr.com/ru/post/1495115/


All Articles