PySide2, or Qt for Python, is becoming more usable: since it has landed on PyPi, it is easy to install on almost every PC. Unfortunately, this does not apply to the RaspberryPis. Actually, there are only wheels for 64 bit x86 (and 32bit on Windows), not ARM. And there's a reason for this: the actual Raspbian Stretch has way too old packages for PySide2 to work. To get PySide2 on a RaspberryPi, you'll need Rasbpian Buster, which has not been released (even though there are repositoryes for an upgrade). Then, you can use the packages already compiled for Debian armhf (which are not in the Raspbian repository, at this moment). This is not straightforward, expecially for beginners. So I made an image, ready to be written on a (at least 16GB) microSD card. This image has Raspbian Buster with the main Qt5 and PySide2 modules. I've also switched the desktop environment from LxDE to LxQt.
You can find the image here:
https://www.codice-sorgente.it/raspbian-buster-pyside2-lxqt/#English
In that page you'll find also links to the Debian Qt5 and PySide2 packages for armhf, if you want to install them on another distro. This image works on a RaspberryPi 3B+, because that's the one I have, but should work also at least on version 3 and 2.
I also wrote an article (actually only in Italian) to demonstrate what could be built with PySide2 on a RaspberryPi: https://www.codice-sorgente.it/2019/01/un-termostato-touchscreen-con-raspberrypi/. The project behind this article is a simple touchscreen thermostat, so it's a multithread Qt MainWindow used in "kiosk mode" on the PiTFT3.5 with a temperature sensor and a relay. If you just want to look at the code, here it is: https://codice-sorgente.it/cgit/termostato-raspberry.git/tree/, but please take note that this code has been written to show different features of PySide2, so it's not really elegant. If someone wants to translate the article in English, I'll be happy.
After successfully installing your QTP / QML based application, the following QS / QML based application
ReplyDeleteis not installed.
"QtQuick.Controls" is not installed
"QtQuick .Layouts "is not installed
That happens because it's not a QtQuick app, and I tried to install only the minimal Qt libraries in order to reduce problems (pyside is not really supported on Raspbian, so there are a couple of errors while installing it). So, there's no QtQuick in the image I provided. But if you want to get QtQuick you can look for the packages on packages.debian.org (e.g.: https://packages.debian.org/buster/python-pyside2.qtquick) and install them manually. Keep in mind the architecture is armhf.
Delete