On 7/21/07, Paul Kienzle <[EMAIL PROTECTED]> wrote: > Hi, > > I'm attaching the canvas object code I've been playing with. > > The API is still incomplete, but in the spirit of release early, > release often, I'll put it out there for people to comment on.
Hey Paul this is really cool stuff. There is a minor bug -- the onAdd callback in bindertest.py on line 26 should be onAddend I think. Also, I wanted to know if you've looked that the copy_region/blit stuff we have. It is specifically designed to speed up stuff like this, where you want to move one or two artists across a stable background. http://www.scipy.org/Cookbook/Matplotlib/Animations examples/poly_editor.py is similar to your example in that you click and drag vertexes to modify the polygon, you can insert vertexes etc. Obviously the API is clunky compared to the stuff you are doing (hence the need for your extensions) but it does use the animation blit API which you could borrow from if you haven't seen it. It may complicate your code, so you can decide, but it would be a critical part of a canvas like API I think. We could improve upon the blit API if necessary to facilitate your work. BTW, poly_editor was broken but I just fixed it so you can check it out of svn if you want to take a look. Right now I don't have any answers or comments to the questions you raise in the code, eg on keyboard vs mouse focus handling -- you are much deeper in this stuff than I am -- so I'll it's probably best if you just keep thinking through these things as you go. As for your traits question, you are absolutely right about the need for a common callback framework. I have been cleaning up the transformations in mpl1 and the callbacks and properties on the affines are tremendously useful (eg xlim is just a property based view into the affine, and one can connect to events on affine changes). I don't have a GUI backend layer yet in which one can begin playing around with interaction, but I am close, with a few more changes, to having a serviceable first cut at the transformations, artist hierarchy, and renderer layer. FYI, every artist does have a callback mechanism built in which you can easily extend to support additional events (right now I have been adding them on as as needed basis -- what traits does so nicely is that they are there for every traited instance). Eg to connect to the Axes xlim: ax.callbacks.connect('xlim_changed', func) and func will be called with the signature func(ax). Eg see examples/shared_axis_across_figures.py which utilizes the callbacks to couple xlim across figure instances. JDH ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel