Hello.

Concretly, I have one figure with some plots. I only want to have the
coordinates of the mouse when it is clicked over this figure.

On the other hand, when I click on the button, I have the button event, but
also the mouse one.

Maybe, one solution would be to know that the button has been clicked such
as to ignore mouse event in that case.

C
Le 29 sept. 2014 03:51, "Benjamin Root" <ben.r...@ou.edu> a écrit :

> I am sorry, I am not sure that I understand what you are trying to do. Why
> do you want the same action to happen whenever you click the mouse button
> (anywhere in the figure), and whenever you click the mouse button (when you
> are over the button)? The two areas overlap, so it would always trigger the
> action twice when clicking on the button.
>
> Why are you attaching the callback to mouse button clicking when it is
> already attached to the Button?
>
> Ben Root
>
> P.S. - please keep the coverstation on-list.
>
>
> On Sun, Sep 28, 2014 at 5:36 PM, Christophe Bal <projet...@gmail.com>
> wrote:
>
>> Hello.
>>
>> I want to use both mouse event, that works without the button, and also a
>> button but adding this ones makes the mouse event also working on this
>> button.
>>
>> The problem would be to connect the mouse event only with the first axe.
>> Can I do that ? Sorry but for the moment, I'm a real noob.
>>
>> 2014-09-28 21:53 GMT+02:00 Benjamin Root <ben.r...@ou.edu>:
>>
>>> Does this example help?
>>> http://matplotlib.org/examples/widgets/buttons.html
>>>
>>> With the Button widget, you won't need to do any mpl_connect calls, the
>>> widget takes care of that for you. Also, as a side note, the
>>> "button_press_event" does not refer to the button widgets, it refers to the
>>> mouse button.
>>>
>>> Cheers!
>>> Ben Root
>>>
>>>
>>> On Sat, Sep 27, 2014 at 6:30 PM, Christophe Bal <projet...@gmail.com>
>>> wrote:
>>>
>>>> Hello.
>>>>
>>>> In the following code, I would like to add two buttons. Is there an
>>>> easy way to do that ?
>>>>
>>>> Christophe
>>>>
>>>>
>>>> ================================
>>>>
>>>> import matplotlib.pyplot as plt
>>>> from matplotlib.widgets import Button
>>>>
>>>> fig = plt.figure()
>>>>
>>>> plt.axes(xlim = (0, 3), ylim = (0, 3))
>>>>
>>>> def onclick(event):
>>>>     print(event.xdata, event.ydata)
>>>>
>>>> fig.canvas.mpl_connect('button_press_event', onclick)
>>>>
>>>> plt.show()
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
>>>> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
>>>> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
>>>> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>>>>
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Matplotlib-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
Slashdot TV.  Videos for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to