How to draw a red 'X' in a specific coordinate by clicking in a qlabel with a pixmap using pyqt5?

310 Views Asked by At

I would like to allow the user to click on a Qlabel (containing a pixmap) at a specific coordinate in order to draw a red point or perhaps a red cross and to extract the specific pixel coordinate in pixmap coordinate system. As I understood, Qpixmap has no mousePressevent and the maximum that I could implement was to print the coordinates of the click in respect of label coordinates. One problem is that when I resize my main window the label also resizes and for a fixed position in the label its coordinate changes dramatically.

Another problem is the impossibility of printing the coordinates in respect of the pixmap coordinates. Anyone knows how to print pixmap coordinates on click and not label coordinates?

Thanks

0

There are 0 best solutions below