Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5.QtWidgets import QGraphicsView
- from PyQt5.QtGui import QPolygonF
- from PyQt5.QtCore import QPoint, QRectF
- class GraphicsView(QGraphicsView):
- def __init__(self, window):
- super().__init__(window)
- def mousePressEvent(self, QMouseEvent):
- rect = self.mapToScene(QMouseEvent.x(), QMouseEvent.y(), self.width()/20, self.width()/20)
- self.scene().addPolygon(rect)
Add Comment
Please, Sign In to add comment