def normalize_pos(widget: QGraphicsItem, pos: QPointF) -> QPointF: bounding = widget.boundingRect() return QPointF(pos.x() / bounding.width(), pos.y() / bounding.height())