PyQt imageViewer does not working properly...

Polimeno rntpolimeno at
Tue Oct 5 00:29:04 CEST 2010

Hello guys,

I have been looking throughout the web for some PyQt Image Viewer :

Unfortunately, everytime I input any kind of image type
(.jpeg, .tga, .png, whatver) It doesn´t show me the image inside the
widget itself.... looks like it ignores the path I did pick...

Even if I use a simple snippet like one below, I can´t get my display

from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys

class ImageViewer(QWidget):

    def __init__(self, imgFile):
        self.image = QImage(imgFile)
        print self, file_Path, '\n'

    def paintEvent(self, event):
        self.painter = QPainter(self)
        self.painter.drawImage(0, 0, self.image)

if __name__ == "__main__":
    Qapp = QApplication(sys.argv)
    Iviewer = ImageViewer(imgFile='C:\\Users\\Administrador\\Desktop\

What am I missing ?

More information about the Python-list mailing list