Robin,
I've moved this over to the wxPython list, as it seemed a more
appropriate place for it.
To the folks, here, this thread started in a thread on the wx developers
list, about a wxCanvas widget (which will be a real boon for wxPython)
Robin Dunn wrote:
> Multiple objects can be created with a single call like:
>
> /* pseudocode*/ DrawRectangles(ListofCoordinates,ListofProperties).
>
> Note: this may sound sound pointless to C++ programmers (why not just
> write a loop?), but it can make a real performance difference for
> wxPython, and other scripting languages. It is also in keeping with the
> kind of high-level interface that we are going for.You won't get as much benefit from this as you might think as the wrapper
code would have to first convert the Python list to a wxList before calling
the method.
HMMM. would it really take longer to build the wxList if there were a
large number of elements? I can see where for ten items, it might not
make sense, but what about for a thousand? Also, it wouldn't have to be
a wxList, is there some other data structure that would make more sense,
an array, whatever?
If something like this was really needed for the Python version
then it would be better to just "write a loop" in the wrapper code and call
the real method multiple times.
OK. I like that A LOT. In fact, I'd love to see it done for the DC's at
this point. (right now I have an application that has to draw 1000 dots
on the screen, each of them 4 pixels each. This means I have to loop
through 4000 tuples of coordinates, and use dc.DrawPoint on each one.
It's really pretty slow. I'd be happy if there were a DrawPoints,
DrawRectangles, etc that would use all the same brush and pen. A more
limited functionality, but still useful to me, and probably pretty easy
to impliment.
How hard would it be to add this? Would it have to be added by hand
every time a new version of the code got SWIGed, or could that be
automated?
One thing that is becoming clear to me is that there are real
limitations to working with a toolbox that was not designed with Python
in mind. Of course, writing a new GUI toolbox from scratch for Python
would be a huge effort that would be unlikely to happen, but it would be
nice. That's one of the nice things about TK. It was written for a
scripting language, and thus is somewhat more natural to use from one. I
know wxPython is not very "Pythonesque" because it is automatically
wrapped, and that that is the only practical way to keep up with wxWin
development. But I am wondering if it is time to start adding features
to wxPython that aren't in wxWin, to try to make it a little more
Pythonesque (like the above). How hard is it to add stuff to the
wrappers SWIG generates?
Anyway these are my thoughts. If we can get a good wxCanvas developed,
there will be no reason for anyone to use TK. (except for that pesky Mac
thing, but that may yet get solved)
···
--
Christopher Barker,
Ph.D.
cbarker@jps.net --- --- ---
http://www.jps.net/cbarker -----@@ -----@@ -----@@
------@@@ ------@@@ ------@@@
Water Resources Engineering ------ @ ------ @ ------ @
Coastal and Fluvial Hydrodynamics ------- --------- --------
------------------------------------------------------------------------
------------------------------------------------------------------------