Qt Lottie
Cross-platform Python library providing Lottie animation support for Qt applications, compatible with both PySide6 and PyQt6.
Features
- QML Component: Feature-rich
LottieAnimationcomponent for QML applications - Python API: Programmatic control of animations from Python
- Cross-binding compatibility: Works with both PySide6 and PyQt6
- Performance optimized: Uses RLottie backend with Qt-style caching
- Zero-configuration: Simple pip installation
Installation
# Auto-detect Qt binding
pip install qt-lottie
# With specific Qt binding
pip install qt-lottie[pyside6]
pip install qt-lottie[pyqt6]
Quick Start
QML Usage
import QtQuick 2.15
import QtQuick.Window 2.15
import QtLottie 1.0
Window {
width: 640
height: 480
visible: true
LottieAnimation {
anchors.centerIn: parent
width: 200
height: 200
source: "path/to/animation.json"
autoPlay: true
loops: -1 // Infinite loops
onFinished: console.log("Animation finished")
}
}
Python Usage
import sys
from PySide6.QtWidgets import QApplication
from PySide6.QtQml import QQmlApplicationEngine
import qtlottie
# Initialize QML types
qtlottie.init_qml()
app = QApplication(sys.argv)
engine = QQmlApplicationEngine()
# Load QML that uses LottieAnimation
engine.load("main.qml")
sys.exit(app.exec())
API Reference
LottieAnimation Properties
Source & Loading
source: url- Animation file path/URLstatus: int- Loading status (Null, Loading, Ready, Error)asynchronous: bool- Async loading (default: true)cacheMode: int- CacheNone, CacheLoop, CacheAll (default: CacheNone)
Playback Control
playing: bool- Play state (default: false)autoPlay: bool- Auto-start (default: false)playbackRate: real- Speed multiplier (default: 1.0)loops: int- Loop count (-1 = infinite)direction: int- Forward, Reverse, Alternate
Timing & Position
position: real- Current time in secondsduration: real- Total duration (read-only)progress: real- Progress 0.0-1.0 (read-only)currentFrame: int- Current frame (read-only)
Visual Properties
tintColor: color- Color overlayfillMode: int- Stretch, PreserveAspectFit, PreserveAspectCropsmooth: bool- Antialiasing (default: true)
Methods
play()- Start animationpause()- Pause animationstop()- Stop and reset animationtoggle()- Toggle play/pauseseek(position)- Seek to time positionseekToFrame(frame)- Seek to frame numberseekToMarker(name)- Seek to named marker
Signals
started()- Animation startedstopped()- Animation stoppedfinished()- Animation finishedpositionChanged(real)- Position changedframeChanged(int)- Frame changedmarkerReached(string)- Marker reachederror(string)- Error occurred
Performance
The library is designed for optimal performance with Qt-style size-based frame caching.
Cache Modes
CacheNone: Render frames on demand (default, lowest memory)CacheLoop: Cache one complete animation loopCacheAll: Cache entire animation (best performance for small animations)
Requirements
- Python 3.8+
- PySide6 or PyQt6
- rlottie-python
- Pillow (for image processing)
License
MIT License - see LICENSE file for details.
Development
Setup
# Clone repository
git clone https://gitlab.com/acemetrics-oss/qt-lottie.git
cd qt-lottie
# Install in development mode
pip install -e ".[dev,pyside6,pyqt6]"
Building
# Build package
python -m build
# Install from wheel
pip install dist/*.whl
# Test basic functionality
python -c "import qtlottie; print('✓ Import successful')"
Testing
# Test examples
cd examples/pyside6
python main.py
cd ../pyqt6
python main.py
Contributing
Contributions welcome! Please see our GitLab repository for guidelines.
Links
- PyPI: https://pypi.org/project/qt-lottie/
- Source Code: https://gitlab.com/acemetrics-oss/qt-lottie
- Issues: https://gitlab.com/acemetrics-oss/qt-lottie/-/issues
- Examples: See examples/ directory in the repository
Support
- Issues: Report bugs and request features on GitLab Issues
- Documentation: Full API reference available in the repository
- Examples: Working examples for both PySide6 and PyQt6 included
Metadata
Release files for qt-lottie 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qt_lottie-0.1.3.tar.gz | 28.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qt_lottie-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.6 kB
Release files / qt_lottie-0.1.3.tar.gz
| Download URL | qt_lottie-0.1.3.tar.gz |
|---|---|
| Size | 28.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cff89c1098a2a23d45b809cf9a7d938a5b863ec93918d219d0925df89d0eff8a
|
|
BLAKE2b-256 checksum How to use checksums |
0ccea9cc871d1c0141280bc3f15d942584e65be303d2600fc49a0be2a0a5e099
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.18
|
Release files / qt_lottie-0.1.3-py3-none-any.whl
| Download URL | qt_lottie-0.1.3-py3-none-any.whl |
|---|---|
| Size | 23.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
976b2a9a367c46c076d592ef3aa1d18a62bfc379eac5077e393b67ce91829d32
|
|
BLAKE2b-256 checksum How to use checksums |
47d2426ac012e1775b0a19b1f8486e102cece0d6d8c345e3433570d2f8721334
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.18
|