From: Egor Z. <ez...@gm...> - 2008-11-27 15:01:25
|
Hi John, John Hunter wrote: > On Wed, Nov 26, 2008 at 11:57 AM, Egor Zindy <ez...@gm...> wrote: > > >> thank you, I'll have to check out the repository to see how I can use the >> changes. >> >> Just a thought: a figure_leave / figure_enter event could be triggered by >> comparing the currently held axis with event.inaxes (that's what Slider and >> my bar widget do in _update() ). >> > > That's exactly how its done. The problem I referred to above (which > will not affect your use case since you are leaving the axes) occurs > when you want to connect to a figure leave event and move your mouse > to a non-mpl window. Then we get no events to compare to the prior. > > JDH > The new version attached that fixes a few of the things I was unhappy about: * radius for clicking the bar now in pixels * case when mouse pointer is outside the graph now handled correctly. * commented the methods a bit more (still working on that) Both these rely on the following two functions: #convert from x to xdata print self.ax.transData.inverted().transform_point((event.x, event.y)) #convert from xdata to x print self.ax.transData.transform_point((event.xdata, event.ydata)) event.x always returns a value, so I used that to "fix" xdata when the cursor is outside the graph Things I have struggled with (this time): * there is a toobar.set_cursor() but no toolbar.get_cursor() which would be interesting to have to set the cursor back to what it should be (rather than arbitrary POINTER type). * more cursor types would be nice (could do with size_ver and size_hor in http://wiki.openusability.org/guidelines/index.php/Design_and_Layout:Visual_Design:Cursors). * took a long time to check out matplotlib from SVN, have yet to check the new events out. * a nice name? (been struggling with that a lot lately!) Is "Bar" OK? or maybe "SelectionBar"? Regards, Egor |