0

We want to save the points that we have clicked on a list with the coordinates or in a database.

Alejandro
  • 1
  • 3

2 Answers2

0

Matplotlib does have buttons, see the example code here, however you might want to look at using something like PyQT5 to create a UI for this purpose. You can setup a GUI quickly with QTDesigner, then use promote a widget to a matplotlib graph (see this tutorial) and link matplotlib's "on click" event handler to whatever purpose you would like to achieve.

Tom McLean
  • 5,583
  • 1
  • 11
  • 36
  • Let me see if i have understood what you have explain to me. I have to create a GUI with pyqt but i can´t add a graph of the qt designer. Instead of that i have to transform a widget into a matplotlib graph. Then, can i connect some buttons with the matplotlib graph ? – Alejandro Mar 25 '21 at 13:50
  • Thats correct, see this post https://stackoverflow.com/questions/43947318/plotting-matplotlib-figure-inside-qwidget-using-qt-designer-form-and-pyqt5 to see how to work with matplotlib graphs with PyQt5. It will take a bit of playing around to understand how PyQt5 works, but have a play around and try and figure it out, its the best way to learn imo. – Tom McLean Mar 25 '21 at 14:52
  • Okey ! I will investigate on that and then try to make it possible. Possibly i will post more questions about that because i have never used python before and that is my first time. – Alejandro Mar 26 '21 at 10:36
0

This is definitely possible with matplotlib, however without a minimum working example it's difficult to give you a full answer. For this kind of project, I've worked with Jupyter notebooks as they allow you to define pressable buttons through widgets (for example here).

I'd start by having a look at matplotlib event handling, and for example this answer for how to record an onclick event.

  • Wow i didn´t know that. But the problem is that i have to creat the GUI application with pycharm. I saw that qt have a lot of widgets and options to create an interface and that is i choose that package, but now i don´t know what i should do..... – Alejandro Mar 25 '21 at 13:54