[PyQt] QGraphicsPixmapItem not showing set pixmap

Jason H scorp1us at yahoo.com
Wed Jan 20 06:13:07 GMT 2010


Simply, your PNG does not exist. Try print QFile.exists('/.../.../pic1.png")
Or
You aren't looking at it. Try using ensureVisible() on it in case its off-screen.




----- Original Message ----
From: dizou <di_zou at yahoo.com>
To: pyqt at riverbankcomputing.com
Sent: Tue, January 19, 2010 12:23:19 PM
Subject: [PyQt]  QGraphicsPixmapItem not showing set pixmap


I have:

class DisplayItem(QGraphicsPixmapItem):
    def __init__(self, parent, graphView=None):
        QGraphicsPixmapItem.__init__(self)

        pic = QPixmap("/.../.../pic1.png")
        self.setPixmap(pic)

and then when I do QGraphicsScene.addItem(DisplayItem), nothing shows up.
I can use the paint() function to draw my DisplayItem as my different shapes
and stuff, so I have my QGraphicsScene and QGraphicsView setup correctly.
-- 
View this message in context: http://old.nabble.com/QGraphicsPixmapItem-not-showing-set-pixmap-tp27229352p27229352.html
Sent from the PyQt mailing list archive at Nabble.com.

_______________________________________________
PyQt mailing list    PyQt at riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt



      



More information about the PyQt mailing list