wxPanel ComboBox: get selected item

The problem is not in your EVT_COMBOBOX line, it's in
your callback
fucntion. back functions are always called with two
parameters: self and
the event, so this:

> def CommandCallback(self):

should be this:

def CommandCallback(self,event):

There are an assortment of other, shall we say

strange,

design elements
in your code. What are all those panels about? Why not
just put your
controls onto the frame with the BoxSizer? Or you

might

want to put on
panel on the frame, and then the controls onto the
panel with the sizer.

You also don't want to give position and size
coordinates to something
you are putting in a sizer.

By the way, when you post code, it's a good idea to
post it as an
enclosure, so that the line endings, spaces, tabs, etc
don't get
mangled. It's easier for someone to quickly test your
code that way.

Enclosed is a start to how I would re-factor your

code:

-Chris

Well, I appreciate the boost on the code that I sent. I
am, unfortunately, going to need the panels since it is
a work in progress and other control features will be
added. I am working on some more changes. Probably
going to have more questions later if you don't mind.

--vicki

vicki@stanfield.net wrote:

Well, I appreciate the boost on the code that I sent. I
am, unfortunately, going to need the panels since it is
a work in progress and other control features will be
added.

Well, I figured that the code was probably a simplification of something
more complex, but it's alwaus best to make it truely as simple as
possible when something doesn't work. For your simple example, the
panels just complicated things.

Also, if your design does call for the sub-panels, chances are it makes
sense for those panels to be a class of there own, kind of like the code
I posted. I dont' knwo if this applies, but one of the powers of Python
and Sizers is that it is easy to dynamically build GUI layouts. You may
want to subclass a wxPanel, and have each instance build itself to fit
the data it needs to present. See this quote from the WingIDE web site:

"""
In many cases, Python's introspection features make it possible to
write generic GUI code that you can use to build user interfaces on the
fly based on models of your data and your application. This can be much
more efficient than using a GUI builder to craft individual menus and
dialogs by hand. In general hand-coded GUIs also tend to be more
maintainable.

"""

It takes some more work up front, but can be very elegant.

I am working on some more changes. Probably
going to have more questions later if you don't mind.

That's what this list is for...

-Chris

ยทยทยท

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov