Reputation: 61
I have to get the coordinates of a section of an image in PyQT. At first I need a widget that can show an image (png or jpeg) but I don't know which can do this. And then I must select a portion of this image with a rectangle and get the top-left and bottom-right coordinates of the rectangle. Thank you
Upvotes: 1
Views: 2144
Reputation: 29896
You can display images:
QLabel
and its method QLabel.setPixmap
, ORQGraphicsScene
/QGraphicsView
, ORQWidget
by redefining the paintEvent
method and using e.g. QPainter.drawPixmap
.Once the image is displayed you can use a QRubberBand
(example) to allow and display the selection.
Upvotes: 3