Don't understand wxPython ids
Doug Holton
insert at spam.here
Wed Apr 28 01:16:12 EDT 2004
>>I can only think of one reasn why they chose to use ids in the first
>>place. Assigning many objects the same id allows you to use one EVT_*
>>call for those objects. But is that really a useful feature? Who knows?
>
>
> That's about the only thing I could think of. The few
> situations where I'd have wanted to do someting like that I'd
> gladly put a for-loop iterating over a list of objects in
> exchange for being able to use single-line of code the other
> 90% of the time.
Right, there a couple of special cases to think of when designing event
bindings for a gui toolkit. One is where you want multiple controls to
share the same event handler (like a button and a menu item that do the
same thing). Another case is allowing people to change event bindings
"on the fly", after a window constructor has already been called and the
window set up.
I proposed some changes similar to you, see this thread:
http://lists.wxwidgets.org/cgi-bin/ezmlm-cgi?11:sss:23979:200311:dcgnanikkojpgmpdpmio#b
but nothing came out of it. I did code up an implementation for Wax
(http://wiki.wxpython.org/index.cgi/Wax ), but I don't know if it was
included.
More information about the Python-list
mailing list