From: Benjamin R. <ben...@ou...> - 2014-09-28 19:53:34
|
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 <pro...@gm...> 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |