why "import wx" doesn't work?

monkey m at m.com
Fri Apr 29 03:44:14 EDT 2005


They both work, thanks for your instruction ( :

> I suspect you are mixing program code for the namespace version (import
> wx) with the old method of importing (from wxPython.wx import *).
>
> Here are two version of a very simple app... try both and see if you get
> any errors. And if so, _please_ post the exact error you get.
>
> --- BEGIN The "new" namespace version ----
>
> import wx
>
> class MainFrame(wx.Frame):
>      def __init__(self, parent, id=-1, title="Test Wx", size=(-1, -1),
> pos=(-1,-1), style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE):
>          wx.Frame.__init__(self, parent, id, title, size, pos, style)
>          self.Show(True)
>
> app = wx.PySimpleApp()
> frame = MainFrame(None, -1, "Test Wx NameSpace Style")
> app.MainLoop()
>
> --- END The "new" namespace version ----
>
> --- BEGIN The old style import ----
>
> from wxPython.wx import *
>
> class MainFrame(wxFrame):
>      def __init__(self, parent, id=-1, title="Test Wx", size=(-1, -1),
> pos=(-1,-1), style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE):
>          wxFrame.__init__(self, parent, id, title, size, pos, style)
>          self.Show(True)
>
> app = wxPySimpleApp()
> frame = MainFrame(None, -1, "Test Wx Old Style")
> app.MainLoop()
>
> --- END The old style import ----
>
> Hope that helped!
>
> Thanks,
> -Kartic
>





More information about the Python-list mailing list