Afficher une image dans un QLabel sous Windows
Bonjour
Je suis confronté à un petit soucis, je développe mais scripts sous linux ubuntu et j'arrive parfaitement à afficher mon image dans mon QLabel, mais lorsque j'essais sous windows xp ou seven, mon image ne s'affiche pas, sans aucune erreur apparente.
Pour sortir de mon script, j'ai repris cet exemple http://zetcode.com/tutorials/pyqt4/widgets2/ :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| #!/usr/bin/python
# ZetCode PyQt4 tutorial
#
# In this example, we show
# an image on the window.
#
# author: Jan Bodnar
# website: zetcode.com
# last edited: February 2010
from PyQt4 import QtGui
class Example(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.initUI()
def initUI(self):
hbox = QtGui.QHBoxLayout(self)
pixmap = QtGui.QPixmap("test.jpg")
label = QtGui.QLabel(self)
label.setPixmap(pixmap)
hbox.addWidget(label)
self.setLayout(hbox)
self.setWindowTitle("Rotunda in Skalica")
self.move(250, 200)
app = QtGui.QApplication([])
exm = Example()
exm.show()
app.exec_() |
Aucun problème sous ubuntu mais aucune image sous windows, l'image est bien au bon endroit, j'ai également essayé en mettant le chemin absolu mais sans résultat.
Auriez vous une idée ?
Merci à vous