supersuraccoon
16th September 2011, 07:28
I added some pixelmaps to a QGraphicsScene:
self.scene.addPixmap(cityPixmap)
and it works fine...
Then I usa for loop to get all the pixelmap like this:
for obj in self.scene.items():
print 'obj'
this also works fine...
But my question is:
say I add some city pixelmaps and some river pixelmaps to the scene, now I want to remove all the river pixelmaps:
for obj in self.scene.items():
if type(obj) == QGraphicsPixmapItem:
#do the remove stuff
but how I can tell the QGraphicsPixmapItem object I got is a river or a city ?
Any reply will be appreciated, thanks:)
self.scene.addPixmap(cityPixmap)
and it works fine...
Then I usa for loop to get all the pixelmap like this:
for obj in self.scene.items():
print 'obj'
this also works fine...
But my question is:
say I add some city pixelmaps and some river pixelmaps to the scene, now I want to remove all the river pixelmaps:
for obj in self.scene.items():
if type(obj) == QGraphicsPixmapItem:
#do the remove stuff
but how I can tell the QGraphicsPixmapItem object I got is a river or a city ?
Any reply will be appreciated, thanks:)