Question on importing wxPython

Steven W. Orr steveo at syslang.net
Mon Jan 28 13:06:16 EST 2008


python-2.3.5
wx-2.6

I just bought the wxPython In Action book and I see that all the examples 
say to
import wx
All of our pre-existing code was horribly doing a
from wxPython import *

I changed all the code so that it was doing an import wx and found that 
everything was broken. In particular, references to wxNewId would fail.

634 > python
Python 2.3.5 (#2, May  4 2005, 08:51:39)
[GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.wxNewId
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
AttributeError: 'module' object has no attribute 'wxNewId'
>>>

In fact, the *only* way to get it was to go back to
import wxPython
and then refer to it as wxPython.wx.wxNewId

Is my system broken or am I missing something? i.e., should I be able to 
say import wx?

TIA

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



More information about the Python-list mailing list