[wxPython] Help with wxChoice!

SNYDER, BARRON F. (AIT) bs1535 at sbc.com
Wed Jun 13 16:29:42 EDT 2001


wxPython version 2.2.5
Python version 2.0

I tried your suggestion of using FindString and it appears as though the
string is appended because FindString finds it. I then thought about what
you said about that if that works, then some other overriding processing may
happen down the line...

Mystery solved!

It turns out that wxDesigner puts a default entry called "ChoiceItem" in the
widget so that the user can see that it is working. Apparently this replaces
any items that had been appended in the __init__ method. Once I deleted the
default entry from the properties screen in wxDesigner my code worked fine.

Thank you very much for your help and suggestions and that "little bit
extra" to get my brain thinking in a new direction!

Barron


-----Original Message-----
From: David Bolen [mailto:db3l at fitlinxx.com]
Sent: Wednesday, June 13, 2001 2:31 PM
To: python-list at python.org
Subject: Re: [wxPython] Help with wxChoice!


"SNYDER, BARRON F. (AIT)" <bs1535 at sbc.com> writes:

> But since you ask <g>, I'm actually trying to append to a wxChoice control
> that was laid out using wxDesigner. Since the widget code is automatically
> generated from wxDesigner, I have to get the handle of the specific widget
I
> want by using wxPyTypeCast.

Hmm, I just tried that as well (not with wxDesigner, but using
FindWindowById on my own created wxChoice window) and it's working for
me, so at first glance I would think that the code you're using ought
to work.  You didn't mention which wxPython release you're using - I
suppose it could be a bug somewhere.  Or could there be anything in
the auto-generated code by wxDesigner that is perhaps clearly out the
choice box at some point in time after you add the information?

You might adding some debugging print's or something just after you
append to the choice, using something like the FindString or GetString
methods to try to determine if the choice thinks the new information
has been added at that point in time.  If so, then it would be an
indication that something later on during processing (which could
still be before the control is actually displayed to the screen) is
removing information.

You might also try directing this to the wxPython mailing list
(wxpython-users at lists.wxwindows.org) and see if anyone there has any
other suggestions.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/
-- 





More information about the Python-list mailing list