updating a Grid on a Notebook panel

Hi,

I’m fairly new to Python and wxPython but enjoying the experience of learning it all. However, I keep coming up against the limits of my newbie knowledge. The most recent example being an inability to update a grid widget held on a notebook panel. The grid should udate in response to a combobox event. I’ve read around the extremely helpful messages on this board and elsewhere but the tme has come to seek expert help! Any comments most welcome! I attach a mini-example.

I’m using OS X, python 2.6.6 and wxPython 2.8.11; unfortunately I get a ‘segmentation fault’ running under Linux but it runs at least on OS X.

wxtestg.py (12.6 KB)

I would recommend to cut it down further in order to identify the poblem. I have tried your code on linux and it runs but there is something wrong with your layout, e.g. the comboxes are not shown.

Christian K.

···

Am 30.01.11 20:06, schrieb lundinlinux:

Hi,

I'm fairly new to Python and wxPython but enjoying the experience of
learning it all. However, I keep coming up against the limits of my
newbie knowledge. The most recent example being an inability to update a
grid widget held on a notebook panel. The grid should udate in response
to a combobox event. I've read around the extremely helpful messages on
this board and elsewhere but the tme has come to seek expert help! Any
comments most welcome! I attach a mini-example.

You are creating two instances of the gridSumPanel, once as a child of the notebook, and once as a child of the panel that holds the notebook, and you are updating the one that is not visible.

Also, next time please review MakingSampleApps - wxPyWiki before sending sample code.

···

On 1/30/11 11:06 AM, lundinlinux wrote:

Hi,

I'm fairly new to Python and wxPython but enjoying the experience of
learning it all. However, I keep coming up against the limits of my
newbie knowledge. The most recent example being an inability to update a
grid widget held on a notebook panel. The grid should udate in response
to a combobox event. I've read around the extremely helpful messages on
this board and elsewhere but the tme has come to seek expert help! Any
comments most welcome! I attach a mini-example.

I'm using OS X, python 2.6.6 and wxPython 2.8.11; unfortunately I get a
'segmentation fault' running under Linux but it runs at least on OS X.

--
Robin Dunn
Software Craftsman

Christian and Robin,
Many thanks for taking the time to look at the code. Robin’s suggestion was spot-on and I attach the revised code here in the hope it might help others. I take both your points about posting the simplest code possible to illustrate the issue; hopefully the amended code is suitably minimalist.

wxtestgv2.py (8.31 KB)

I'd say you could trim a lot more. When you do these things, I would
just truly make the most minimal thing I could. Don't user sizers
(unless your problem is about sizers), just put a frame with a single
panel, a combobox with choices a, b, and c, and a grid. Having more
than one panel and an AUI notebook and subclassing just complicates
it.

As an exercise, try to redo your sample in under 50 lines of code.

Che

···

On Mon, Jan 31, 2011 at 1:55 PM, lundinlinux <john.moncrieff@gmail.com> wrote:

Christian and Robin,
Many thanks for taking the time to look at the code. Robin's suggestion was
spot-on and I attach the revised code here in the hope it might help others.
I take both your points about posting the simplest code possible to
illustrate the issue; hopefully the amended code is suitably minimalist.