Deciphering Error Message

When I generate code from wxGlade for my application, I get the attached
scUI.py file. However, when I try to run the file (python scUI.py) I see this
error message:

   File "scUI.py", line 132, in __init__
     self.grid_1 = wx.grid.Grid(self.notebook_1_pane_2, -1, size=(1, 1))
AttributeError: 'module' object has no attribute 'grid'

   The wxWidgets class description doesn't tell me what's wrong. Since this is
my first attempt to use a grid widget I cannot see the error. Please point it
out to me.

Thanks,

Rich

scUI.py (35.9 KB)

···

--
Dr. Richard B. Shepard, President | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

It's missing a:

import wx.grid

Ricardo

···

On Tue, 2005-08-16 at 18:14 -0700, Rich Shepard wrote:

   When I generate code from wxGlade for my application, I get the attached
scUI.py file. However, when I try to run the file (python scUI.py) I see this
error message:

   File "scUI.py", line 132, in __init__
     self.grid_1 = wx.grid.Grid(self.notebook_1_pane_2, -1, size=(1, 1))
AttributeError: 'module' object has no attribute 'grid'

   The wxWidgets class description doesn't tell me what's wrong. Since this is
my first attempt to use a grid widget I cannot see the error. Please point it
out to me.

Thanks,

Ricardo,

   Hmmm-m-m. Why doesn't 'import wx' import everything? I thought this was
equivalent to 'from wxPython import *'.

Many thanks,

Rich

···

On Wed, 17 Aug 2005, Ricardo Pedroso wrote:

It's missing a:

import wx.grid

--
Dr. Richard B. Shepard, President | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

"import wx" imports all modules in the "wx." namespace, but not other
namespaces - "wx.grid" is a separate namespace.

Horst

···

On Wed, 17 Aug 2005 12:37, Rich Shepard wrote:

Hmmm-m-m. Why doesn't 'import wx' import everything? I thought this was
equivalent to 'from wxPython import *'

... and it's in a different namespace, like the HtmlWindow (in wx.html)
because they are more complex controls and we don't need them every
time, avoiding unnecessary load/memory overhead.

At least I think it's the reason for this, someone correct me if I am
wrong.

Ricardo

···

On Wed, 2005-08-17 at 12:42 +1000, Horst Herb wrote:

On Wed, 17 Aug 2005 12:37, Rich Shepard wrote:
> Hmmm-m-m. Why doesn't 'import wx' import everything? I thought this was
> equivalent to 'from wxPython import *'

"import wx" imports all modules in the "wx." namespace, but not other
namespaces - "wx.grid" is a separate namespace.

Horst,

   That's good to know. Where do I find a list of all namespaces? I don't find
such a list in the docs I downloaded.

Thanks very much,

Rich

···

On Wed, 17 Aug 2005, Horst Herb wrote:

"import wx" imports all modules in the "wx." namespace, but not other
namespaces - "wx.grid" is a separate namespace.

--
Dr. Richard B. Shepard, President | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

http://wxpython.org/docs/api/

The top box lists all wx namespaces ("sub-modules") like grid, html etc.

Cheers,
Horst

···

On Wed, 17 Aug 2005 10:44, Rich Shepard wrote:

That's good to know. Where do I find a list of all namespaces? I don't
find such a list in the docs I downloaded.

Horst,

   Thanks very much. I missed that before.

Rich

···

On Wed, 17 Aug 2005, Horst Herb wrote:

wxPython API Documentation — wxPython Phoenix 4.2.2 documentation
The top box lists all wx namespaces ("sub-modules") like grid, html etc.

--
Dr. Richard B. Shepard, President | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863