Guest User

Untitled

a guest
Apr 4th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. from PyQt5.QtWidgets import QGraphicsView
  2. from PyQt5.QtGui import QPolygonF
  3. from PyQt5.QtCore import QPoint, QRectF
  4.  
  5. class GraphicsView(QGraphicsView):
  6.     def __init__(self, window):
  7.         super().__init__(window)
  8.  
  9.     def mousePressEvent(self, QMouseEvent):
  10.         rect = self.mapToScene(QMouseEvent.x(), QMouseEvent.y(), self.width()/20, self.width()/20)
  11.         self.scene().addPolygon(rect)
Add Comment
Please, Sign In to add comment