[PyQt] QGraphicsPixmapItem not showing set pixmap

Nick Gaens nickgaens at gmail.com
Thu Jan 21 11:16:40 GMT 2010


Did you try QFile.exists('/.../.../pic1.png') ?

I'm guessing you are trying to do:

pic = QPixmap('../../pic1.png') <- note the change in the path to the 
image file.


Nick

On 20/01/2010 22:21, dizou wrote:
> The PNG does exist. I did DisplayItem.ensureVisible(10, 10, 10, 10) and
> DisplayItem.ensureVisible() and neither function did anything. There were no
> errors though.
>
> Jason H-3 wrote:
>    
>> 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
>>
>>
>>
>>
>>
>> _______________________________________________
>> PyQt mailing list    PyQt at riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>>
>>      
>    


More information about the PyQt mailing list