SourceForge logo
SourceForge logo
Menu

Re: [matplotlib-devel] canvas objects

From: John H. <jd...@gm...> - 2007年07月06日 15:15:50
On 7/6/07, Paul Kienzle <pki...@ni...> wrote:
> Hi,
>
> I've been playing with the pick infrastructure in 0.90 and find that
> it doesn't meet my needs. The issue is that events from all artists
> go to the same callback, so you are forced write your callback as a
> series of if statements for each artist which may receive a pick event.
I definitely agree that having to write one callback for all the
different objects you may want to pick on is a bad design, so I'd be
happy to see something better. Do you think it would make sense to
register callbacks with a given artist -- eg if you are picked call me
-- or with a class (eg all Line3D picks call me), or do you have
another approach in mind?
> I would rather have an infrastructure more like a canvas, where I
> can register callbacks to particular handles for particular
> mouse events (enter, leave, motion, press and release). I would like
> to rely on the zorder attribute of artists when processing the
> events. If the callback succeeds, then the event is consumed and
> no more handles are checked. If the callback fails then the next
> lower zorder handle is checked.
>
> I can simulate what I want with the current infrastructure by having
> the mouse events call figure.pick() and the pick event capture
> every object that was picked, but it is ugly and not very
> efficient (not every object wants to track enter/motion/leave
> events for example, but they get asked on every pick even if
> they only want to monitor mouse clicks).
>
> Instead I would like to start by splitting the current pick method
> into two parts:
> contains(event,picker) which returns truth value,details
> pick(event) which generates the current pick event
>
> Later I can construct the infrastructure I want on the contains()
> function for each artist.
>
> Does this approach seem reasonable to those who will approve the
> patches I will send?
I don't really understand the contains part -- can you elaborate a little bit?
I would definitely be amenable to accepting patches that improve the
current API :-)
If you want to support things like mouse over, in which the pick will
have to be computed on mouse motion, we'll want to do some caching, eg
in line, to make this more efficient. The current approach is fairly
expensive but that's fine for single click picks, but not for
continuous mouse motion.
JDH

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /