Skip to content

PythonQt.QtGui.QMovie

QMovie

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

This class is used to show simple animations without sound. If you want to display video and media content, use the Qt Multimedia multimedia framework instead.

First, create a QMovie object by passing either the name of a file or a pointer to a QIODevice containing an animated image format to QMovie's constructor. You can call isValid() to check if the image data is valid, before starting the movie. To start the movie, call start(). QMovie will enter Running state, and emit started() and stateChanged(). To get the current state of the movie, call state().

To display the movie in your application, you can pass your QMovie object to QLabel::setMovie(). Example:

QLabel label;
QMovie *movie = new QMovie("animations/fire.gif");

label.setMovie(movie);
movie->start();

Whenever a new frame is available in the movie, QMovie will emit updated(). If the size of the frame changes, resized() is emitted. You can call currentImage() or currentPixmap() to get a copy of the current frame. When the movie is done, QMovie emits finished(). If any error occurs during playback (i.e, the image file is corrupt), QMovie will emit error().

You can control the speed of the movie playback by calling setSpeed(), which takes the percentage of the original speed as an argument. Pause the movie by calling setPaused(true). QMovie will then enter Paused state and emit stateChanged(). If you call setPaused(false), QMovie will reenter Running state and start the movie again. To stop the movie, call stop().

Certain animation formats allow you to set the background color. You can call setBackgroundColor() to set the color, or backgroundColor() to retrieve the current background color.

currentFrameNumber() returns the sequence number of the current frame. The first frame in the animation has the sequence number 0. frameCount() returns the total number of frames in the animation, if the image format supports this. You can call loopCount() to get the number of times the movie should loop before finishing. nextFrameDelay() returns the number of milliseconds the current frame should be displayed.

QMovie can be instructed to cache frames of an animation by calling setCacheMode().

Call supportedFormats() for a list of formats that QMovie supports.

Source: https://doc.qt.io/archives/qt-5.15/qmovie.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
CacheAll attribute Any
CacheMode attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
CacheNone attribute Any (shared captured text)
MovieState attribute type Convert a number or string to an integer, or return 0 if no arguments are given.
NotRunning attribute Any (shared captured text)
Paused attribute Any (shared captured text)
Running attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
backgroundColor function (self) -> Any X.backgroundColor() -> PythonQt.QtGui.QColor
blockSignals function (self, b: Any) -> bool X.blockSignals(b) -> bool (shared captured text)
cacheMode attribute Any This property holds the movie's cache mode
childEvent function (self, event: Any) -> Any (shared captured text)
children function (self) -> tuple X.children() -> tuple (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
connect function (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool X.connect(signal, receiver, slot, type) -> bool (shared captured text)
currentFrameNumber function (self) -> int X.currentFrameNumber() -> int
currentImage function (self) -> Any X.currentImage() -> PythonQt.QtGui.QImage
currentPixmap function (self) -> Any X.currentPixmap() -> PythonQt.QtGui.QPixmap
customEvent function (self, event: Any) -> Any (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteLater function (self) -> Any (shared captured text)
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QMovie.destroyed; argument details are not documented.
device function (self) -> Any X.device() -> PythonQt.QtCore.QIODevice
disconnect function (self, signal: Any, receiver: Any, slot: Any) -> bool X.disconnect(signal, receiver, slot) -> bool (shared captured text)
dumpObjectInfo function (self) -> Any (shared captured text)
dumpObjectTree function (self) -> Any (shared captured text)
dynamicPropertyNames function (self) -> Any (shared captured text)
error function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QMovie.error; argument details are not documented.
event function (self, event: Any) -> bool X.event(event) -> bool (shared captured text)
eventFilter function (self, watched: Any, event: Any) -> bool X.eventFilter(watched, event) -> bool (shared captured text)
fileName function (self) -> str X.fileName() -> str
findChild function (self, type: Any, name: Any) -> Any X.findChild(type, name) -> PythonQt.private.QObject (shared captured text)
findChildren function (self, type: Any, name: Any) -> tuple X.findChildren(type, name) -> tuple (shared captured text)
finished function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QMovie.finished; argument details are not documented.
format function (self) -> Any X.format() -> PythonQt.QtCore.QByteArray
frameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QMovie.frameChanged; argument details are not documented.
frameCount function (self) -> int X.frameCount() -> int
frameRect function (self) -> Any X.frameRect() -> PythonQt.QtCore.QRect
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isValid function (self) -> bool X.isValid() -> bool
isWidgetType function (self) -> bool X.isWidgetType() -> bool (shared captured text)
isWindowType function (self) -> bool X.isWindowType() -> bool (shared captured text)
jumpToFrame function (self, frameNumber: int) -> bool X.jumpToFrame(frameNumber) -> bool
jumpToNextFrame function (self) -> bool X.jumpToNextFrame() -> bool
killTimer function (self, id: Any) -> Any (shared captured text)
loopCount function (self) -> int X.loopCount() -> int
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
moveToThread function (self, thread: Any) -> Any (shared captured text)
nextFrameDelay function (self) -> int X.nextFrameDelay() -> int
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QMovie.objectNameChanged; argument details are not documented.
parent function (self) -> Any X.parent() -> PythonQt.private.QObject (shared captured text)
property function (self, name: Any) -> Any X.property(name) -> object (shared captured text)
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
resized function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QMovie.resized; argument details are not documented.
scaledSize function (self) -> Any X.scaledSize() -> PythonQt.QtCore.QSize
sender function (self) -> Any X.sender() -> PythonQt.private.QObject (shared captured text)
senderSignalIndex function (self) -> int X.senderSignalIndex() -> int (shared captured text)
setBackgroundColor function (self, color: Any) -> None For image formats that support it, this function sets the background color to color.
setCacheMode function (self, mode: Any) -> None
setDevice function (self, device: Any) -> None Sets the current device to device.
setFileName function (self, fileName: str) -> None Sets the name of the file that [QMovie](https://doc.qt.io/archives/qt-5.15/qmovie.html) reads image data from, to fileName.
setFormat function (self, format: Any) -> None Sets the format that [QMovie](https://doc.qt.io/archives/qt-5.15/qmovie.html) will use when decoding image data, to format.
setObjectName function (self, name: Any) -> Any (shared captured text)
setParent function (self, parent: Any) -> Any (shared captured text)
setPaused function (self, paused: bool) -> None If paused is true, [QMovie](https://doc.qt.io/archives/qt-5.15/qmovie.html) will enter [Paused](https://doc.qt.io/archives/qt-5.15/qmovie.html#MovieState-enum) state and emit…
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
setScaledSize function (self, size: Any) -> None Sets the scaled frame size to size.
setSpeed function (self, percentSpeed: int) -> None
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
speed attribute int This property holds the movie's speed
start function (self) -> None Starts the movie.
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
started function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QMovie.started; argument details are not documented.
state function (self) -> Any Returns the current state of [QMovie](https://doc.qt.io/archives/qt-5.15/qmovie.html).
stateChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QMovie.stateChanged; argument details are not documented.
stop function (self) -> None Stops the movie.
supportedFormats function (self) -> Any Returns the list of image formats supported by [QMovie](https://doc.qt.io/archives/qt-5.15/qmovie.html).
thread function (self) -> Any (shared captured text)
timerEvent function (self, event: Any) -> Any (shared captured text)
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)
updated function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QMovie.updated; argument details are not documented.