2016-10-07 17 views
0

QgraphicsSceneでQgraphicsSceneを使用していくつかの図形を作成しました。 QGraphicsSceneをクリアせずにこれらの図形だけをクリアしたいと思います。それはpyqt4で行われているかPyQt QGraphicsScene/QGraphicsView

 self.scene.addEllipse(point.x(), point.y(), 2, 2, pen,brush) 

は、誰かが私を提案することはできますか?

答えて

1

作成した楕円はQGraphicsItemです。そしてQGraphicsSceneは、アイテムを除去する方法があります:removeItemは、 documentation here

を参照してくださいだから私はそのようにコードを修正することをお勧め:

myEllipse = self.scene.addEllipse(point.x(), point.y(), 2, 2, pen,brush) 
self.scene.removeItem(myEllipse)