PyQt imageViewer does not working properly...
Polimeno
rntpolimeno at gmail.com
Mon Oct 4 18:29:04 EDT 2010
Hello guys,
I have been looking throughout the web for some PyQt Image Viewer :
http://nullege.com/codes/show/src%40pyformex-0.8.2%40pyformex%40gui%40imageViewer.py/78/PyQt4.QtGui.QImage#
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
image...
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys
class ImageViewer(QWidget):
def __init__(self, imgFile):
QWidget.__init__(self)
self.image = QImage(imgFile)
print self, file_Path, '\n'
self.update()
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\
\Img_001.jpg')
Iviewer.show()
Qapp.exec_()
What am I missing ?
More information about the Python-list
mailing list