Umair Ahmed
Umair Ahmed

Reputation: 11694

Error running tutorial that came along wxPython2.8 Docs and Demos

I tried the following example code from the tutorial that came along "wxPython2.8 Docs and Demos" package.

import wx

from frame import Frame

class App(wx.App):
    """Application class."""

    def OnInit(self):
        self.frame = Frame()
        self.frame.Show()
        self.SetTopWindow(self.frame)
        return True

def main():
    app = App()
    app.MainLoop()

if __name__ == '__main__':
    main()

but its giving me the following error

Traceback (most recent call last):
  File "C:/Documents and Settings/umair.ahmed/Desktop/wxpy.py", line 3, in <module>
    from frame import Frame
ImportError: No module named frame

kindly help i am just a newbie with python

Upvotes: 1

Views: 154

Answers (2)

Alex Martelli
Alex Martelli

Reputation: 881635

Yeah, it's an ancient doc bug, see for example this 5-years-old post:-(. Fix:

  • delete the line that says from frame import Frame
  • change the line that says self.frame = Frame() to say instead self.frame = wx.Frame()

Upvotes: 0

Ned Batchelder
Ned Batchelder

Reputation: 375574

I think you should skip the "from frame import Frame" and change:

self.frame = Frame()

to:

self.frame = wx.Frame()

Upvotes: 1

Related Questions