我使用QgraphicsScene在QgraphicsView中创建了一些形状。现在我只想清除这些形状,而不清除QGraphicsScene。
self.scene.addEllipse(point.x(), point.y(), 2, 2, pen,brush)有没有人能建议我在pyqt4中是怎么做的?
发布于 2016-12-05 16:55:19
您创建的椭圆是一个QGraphicsItem。QGraphicsScene有一个删除项的方法: removeItem,请参阅documentation here
所以我建议像这样修改你的代码:
myEllipse = self.scene.addEllipse(point.x(), point.y(), 2, 2, pen,brush)
self.scene.removeItem(myEllipse)https://stackoverflow.com/questions/39925340
复制相似问题