├── Dockerfile ├── README.md ├── example-screenshot.png └── test ├── echo.mp4 ├── hello.py └── hello.qml /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM fadawar/docker-pyqt5-qml 2 | 3 | MAINTAINER fadawar 4 | 5 | # Install additional PyQt5 packages 6 | RUN apt-get install -y \ 7 | python3-pyqt5.qtmultimedia \ 8 | # Install Gstreamer 9 | gstreamer1.0-libav \ 10 | gstreamer1.0-plugins-bad \ 11 | gstreamer1.0-plugins-base \ 12 | gstreamer1.0-plugins-base-apps \ 13 | gstreamer1.0-plugins-good \ 14 | gstreamer1.0-plugins-ugly \ 15 | alsa-base \ 16 | alsa-utils 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-pyqt5-qml-qtmultimedia 2 | Dockerfile for development of GUI applications with Python 3 + PyQt5 + QML + QtMultimedia 3 | 4 | Tested on Ubuntu 16.04, 16.10, 18.10 5 | 6 | https://github.com/jozo/docker-pyqt5-qml-qtmultimedia 7 | 8 | https://hub.docker.com/r/fadawar/docker-pyqt5-qml-qtmultimedia/ 9 | 10 | ## How to use it 11 | You can **clone** this github repository and then run this command to check if it's working 12 | 13 | **Run** 14 | ``` 15 | docker run -it \ 16 | -v /tmp/.X11-unix:/tmp/.X11-unix \ 17 | -v $(pwd)/test:/app \ 18 | -e DISPLAY=$DISPLAY \ 19 | -u qtuser \ 20 | --group-add audio \ 21 | --device /dev/snd \ 22 | fadawar/docker-pyqt5-qml-qtmultimedia python3 /app/hello.py 23 | ``` 24 | 25 | You should see window similar to this: 26 | 27 | ![Screenshot](example-screenshot.png) 28 | 29 | **Build** 30 | ``` 31 | docker build -t fadawar/pyqt5-qml-qtmultimedia . 32 | ``` 33 | 34 | ## Other Dockerfiles 35 | **Python 3 + PyQt5:** 36 | https://github.com/jozo/docker-pyqt5 37 | 38 | **Python 3 + PyQt5 + QML:** 39 | https://github.com/jozo/docker-pyqt5-qml 40 | 41 | **Python 3 + PyQt5 + QML + QtMultimedia:** 42 | https://github.com/jozo/docker-pyqt5-qml-qtmultimedia 43 | -------------------------------------------------------------------------------- /example-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jozo/docker-pyqt5-qml-qtmultimedia/4dcc534f546aabababeaf3bc0bafb72ba1221d6f/example-screenshot.png -------------------------------------------------------------------------------- /test/echo.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jozo/docker-pyqt5-qml-qtmultimedia/4dcc534f546aabababeaf3bc0bafb72ba1221d6f/test/echo.mp4 -------------------------------------------------------------------------------- /test/hello.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | from PyQt5.QtCore import QUrl 5 | from PyQt5.QtGui import QGuiApplication 6 | from PyQt5.QtQuick import QQuickView 7 | 8 | if __name__ == '__main__': 9 | app = QGuiApplication(sys.argv) 10 | app.setApplicationName("Hello World") 11 | 12 | view = QQuickView() 13 | view.setResizeMode(QQuickView.SizeRootObjectToView) 14 | view.setSource( 15 | QUrl.fromLocalFile(os.path.join(os.path.dirname(__file__), 'hello.qml')) 16 | ) 17 | view.show() 18 | 19 | sys.exit(app.exec_()) 20 | -------------------------------------------------------------------------------- /test/hello.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import QtMultimedia 5.0 3 | 4 | Rectangle { 5 | id: root 6 | width: 500; height: 300 7 | color: "#C9E5AB" 8 | 9 | Text { 10 | anchors { horizontalCenter: parent.horizontalCenter } 11 | text: "Click below to play video" 12 | } 13 | 14 | Video { 15 | id: video 16 | width : 400 17 | height : 300 18 | source: "echo.mp4" 19 | anchors { horizontalCenter: parent.horizontalCenter } 20 | 21 | MouseArea { 22 | anchors.fill: parent 23 | onClicked: { 24 | video.play() 25 | } 26 | } 27 | 28 | focus: true 29 | Keys.onSpacePressed: video.playbackState == MediaPlayer.PlayingState ? video.pause() : video.play() 30 | Keys.onLeftPressed: video.seek(video.position - 5000) 31 | Keys.onRightPressed: video.seek(video.position + 5000) 32 | } 33 | } --------------------------------------------------------------------------------