[wxPython-users] widget suggestion / question
Robin Dunn
robin at alldunn.com
Mon Dec 3 12:38:53 PST 2007
Mark Erbaugh wrote:
> Chris,
>
> On Mon, 2007-12-03 at 11:19 -0800, Christopher Barker wrote:
>> Mark Erbaugh wrote:
>>> Thanks for the example. I think it should work, but I was hoping to
>>> avoid using the widget's label. It's possible that you might want to
>>> change the label text (say for internationalization) without changing
>>> the underlying code.
>> right, the label isn't necessarily the best key. yous can use the Label,
>> you can use the ID (which you can get by .getID(), after creating the
>> object with the default).
>>
>> Most importantly though -- this is Python! it's been said before in this
>> thread, but it bears repeating: you can any attribute you want to any
>> object, no problem at all. For instance, using the previous example, I
>> might do:
>
> Yes, I understand this and have used it. I still think it would be nice
> if there were an 'official' data member that the user could use for
> whatever was needed.
Actually, there is one in C++ but wxPython is already using it to store
a pointer to the PyObject which is the Python proxy of the C++ object.
This is what allows you to be able to assign arbitrary attributes to the
original proxy instance and then later when something like
event.GetEventObject() returns a proxy it is the same one that you
assigned attributes to instead of a new instance that proxies the same
C++ object.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list