I went with something similair.
self.label_a = pg.TextItem("[A]", color=(255, 255, 255))
self.label_a.setAnchor((0, 1))
self.label_a.setParentItem(line_segmet_roi)
self.label_a.setPos(x0, y0)
self.label_b = pg.TextItem("[B]", color=(255, 255, 255))
self.label_b.setAnchor((0, 0))
self.label_a.setParentItem(line_segmet_roi)
self.label_b.setPos(x1, y1)
def update_point_label_positions(self):
point1 = self.line_segment_roi["ROI"].getSceneHandlePositions(0)
_, scene_coords = point1
coords_a = self.line_segment_roi["ROI"].mapSceneToParent(scene_coords)
point2 = self.line_segment_roi["ROI"].getSceneHandlePositions(1)
_, scene_coords = point2
coords_b = self.line_segment_roi["ROI"].mapSceneToParent(scene_coords)
self.label_a.setPos(coords_a.x(), coords_a.y())
self.label_b.setPos(coords_b.x(), coords_b.y())
Thx for your reply. Luka.
On Wednesday, December 12, 2018 at 4:21:29 PM UTC+1, Luka Drmic wrote:
>
> As the title suggests. Is there a way to add a LabelItem() that is
> connected to a Handle() of a lineRoi(). Meaning it follows the handle if
> the handle is moved.
>
> Thanks.
>
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/d833dea0-719d-422a-85e1-b1888dca7d0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.