Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyRect(QGraphicsRectItem):
- def mousePressEvent(self, event):
- event.accept() if MainScreen.click1 else event.ignore()
- def mouseReleaseEvent(self, event):
- coord = event.buttonDownScenePos(Qt.LeftButton)
- obj=MyEllipse.last_click[2]
- x1=MyEllipse.last_click[0]
- y1=MyEllipse.last_click[1]
- x2 = coord.x()
- y2 = coord.y()
- MainScreen.moving(obj,x1,x2,y1,y2)
- class MainScreen():
- click1 = False
- click2 = False
- @staticmethod
- def moving(obj,x1,x2,y1,y2):
- '''moving figure from one place to another
- we must know figure which is on the x2 y2 coord, then
- we must kmow its normal coord ... and after it replace ellipse'''
- item = get_scene().itemAt(x2,y2)
- print(item)
- obj.setRect(x2,y2,50,50)
- def get_scene(self):
- return self.scene
- def setupMS(self,MainWindow):
- self.scene=QGraphicsScene()
- self.scene.setSceneRect(0,0,600,600)
- self.create_icons()
- self.create_checkers()
- self.labels_create()
- checkers = self.object_checkers()
- white_checkers = checkers[:13]
- black_checkers = checkers[13:]
- white_checkers[0].hide()
- print(type(white_checkers[0]))
- self.view = QGraphicsView(self.scene)
- self.view.centerOn(0,0)
- self.view.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement