Skip to content

Commit

Permalink
Show xy coordinate in the status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Jun 13, 2024
1 parent 1fd98ba commit 913927c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions labelme/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ def __init__(
crosshair=self._config["canvas"]["crosshair"],
)
self.canvas.zoomRequest.connect(self.zoomRequest)
self.canvas.mouseMoved.connect(
lambda pos: self.status(f"Mouse is at: x={pos.x()}, y={pos.y()}")
)

scrollArea = QtWidgets.QScrollArea()
scrollArea.setWidget(self.canvas)
Expand Down
3 changes: 3 additions & 0 deletions labelme/widgets/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Canvas(QtWidgets.QWidget):
shapeMoved = QtCore.Signal()
drawingPolygon = QtCore.Signal(bool)
vertexSelected = QtCore.Signal(bool)
mouseMoved = QtCore.Signal(QtCore.QPointF)

CREATE, EDIT = 0, 1

Expand Down Expand Up @@ -234,6 +235,8 @@ def mouseMoveEvent(self, ev):
except AttributeError:
return

self.mouseMoved.emit(pos)

self.prevMovePoint = pos
self.restoreCursor()

Expand Down

0 comments on commit 913927c

Please sign in to comment.