[PyQt] QMovie causes runtime error when applied to QLabel

Sven Grunewaldt strayer at olle-orks.org
Wed Aug 13 11:05:12 BST 2008


Hi,

I want to display an image in a QLabel and while downloading it, I want
to display the usual nice ajax gif.
After a little bit of searching around I found QMovie(), but whenever I
apply it to a QLabel I get a runtime error on the pythonw.exe :(

I got the loading gif from http://www.ajaxload.info/ and attached it to
the email.

Code:
import sys
from PyQt4.QtGui import *

app = QApplication(sys.argv)

label = QLabel("Test", None)

gif = QMovie()
gif.setFileName("test.gif")
img = QImage()
img.load("test.gif")

# Causes runtime error
# label.setMovie(gif)

# Works, but is not animated
label.setPixmap(QPixmap.fromImage(img))

label.show()
app.exec_()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.gif
Type: image/gif
Size: 9427 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080813/2924388a/test-0001.gif


More information about the PyQt mailing list