wx.Grid Example

I would like an example of properly defining and implementing a wx.Grid.
The new API doc and the wxWidgets book helped me create what I thought would
work, but I'm still getting an error: "AttributeError: 'module' object has no
attribute 'Grid'."

   So, an example would help greatly. I find nothing on the wiki and Google
doesn't turn up an example.

Thanks,

Rich

···

--
Richard B. Shepard, Ph.D. | 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

Rich Shepard wrote:

  I would like an example of properly defining and implementing a wx.Grid.
The new API doc and the wxWidgets book helped me create what I thought would
work, but I'm still getting an error: "AttributeError: 'module' object has no
attribute 'Grid'."

Quick thought: make sure the module that you're thinking of is the same as the module that the message is referring to. Sometimes, "print >>sys.stderror, dir(object)" helps.

Happy hunting,
Don Dwiggins
Advanced Publishing Technology

Rich Shepard wrote:

  I would like an example of properly defining and implementing a wx.Grid.
The new API doc and the wxWidgets book helped me create what I thought would
work, but I'm still getting an error: "AttributeError: 'module' object has no
attribute 'Grid'."

  So, an example would help greatly. I find nothing on the wiki and Google
doesn't turn up an example.

Thanks,

Rich

It's not obvious in the demo, but you have to import wx.grid (lower case) to get at the grid classes. I usually do:

import wx.grid as grid
class MyGrid(grid.Grid):
    def __init__(self,parent,....
        ....
        grid.Grid.__init__(self,parent,...

hth,
Paul Probert
University of Wisconsin

Don,

   Thank you. It is the correct one. I didn't print the entire string of
messages, but they refer to the one module that tries to call wx.Grid, and to
the specific line, too.

Rich

···

On Mon, 5 Dec 2005, Don Dwiggins wrote:

Quick thought: make sure the module that you're thinking of is the same as
the module that the message is referring to. Sometimes, "print

sys.stderror, dir(object)" helps.

--
Richard B. Shepard, Ph.D. | 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

Thanks, Paul. I was looking for a demo and just found one here from Andrea.
Your message helps a lot, too.

   My error (one of many, probably) was in not defining it as a class, but
trying to use it directly in a panel.

Rich

···

On Mon, 5 Dec 2005, Paul Probert wrote:

It's not obvious in the demo, but you have to import wx.grid (lower case)
to get at the grid classes. I usually do:

import wx.grid as grid
class MyGrid(grid.Grid):
  def __init__(self,parent,....
      ....
      grid.Grid.__init__(self,parent,...

--
Richard B. Shepard, Ph.D. | 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