[Tutor] Problem wxPython

Andre Roberge andre.roberge at gmail.com
Fri Feb 17 14:22:09 CET 2006


On 2/17/06, Prabhakar K <prabhu.chinnee at gmail.com> wrote:
> Hai to all,
>
>         I installed ActivePython-2.4.1-247-win32-ix86 and
> wxPython2.6-win32-ansi-2.6.2.1-py2 in my system. When i Run
> a wxPython example.. geeting an Errors
>
[snip]
>   File "F:\python\wx.py", line 1, in ?
>     from wxPython.wx import *
> ImportError: No module named wx
>
>

wxPython changed "notation" between version 2.4 and 2.6 (if memory is
right), and your code is using the old notation with the new package. 
Try (untested) the following changes:

> from wxPython.wx import *
import wx
>
> class MyApp(wxApp):
class MyApp(wx.App):
>     def OnInit(self):       #no change
>         frame = wxFrame(NULL, -1, "Hello from wxPython")
        frame = wx.Frame(None, -1, "Hello from wxPython")
>         frame.Show(true)
        frame.Show(True)
>         self.SetTopWindow(frame)     #no change
>         return true
        return True
>
> app = MyApp(0)
> app.MainLoop()
>

André
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
>


More information about the Tutor mailing list