Install PyQt5 package with:
python -m pip install pyqt5
Install the designer from https://www.qt.io/download-qt-installer
pyuic5 templates/main_window.ui -o main_window.py
Use QThreads.
Create a class and subclass QThread
.
Create a signal(channel) using pyqtSignal
and specify what it should expect:
done_signal = pyqtSignal(str)
Tie the done signal to a function in the calling object
thread.done_signal.connect(func_name)
And then in the QThread class call emit:
self.done_signal.emit(output_value)
If the thread is called in a short-lived function, store the thread in an object or somewhere where it won't get garbage collected before it finishes running.
Use PyInstaller to create standalone packages.
python -m pip install pyinstaller
pyinstall myapp.py
There are a few dialog options:
QInputDialog.get{Int,Double,Item,Text}()
QColorDialog
QFileDialog
QFontDialog
QInputDialog
QMessageBox.{question,etc}()
QWizard
QErrorMessage
Create a QSystemTrayIcon
, then call set_icon()
on it and then show()
.
Create a QMenu
, call addAction
to add QAction
s that have been
created and connected to a callback using action.triggered.connect(func_name)
.
Then attach the QMenu
to the QSystemTrayIcon
using tray_icon.setContextMenu(menu)
.
You can display balloon alerts from the tray icon using tray_icon.showMessage()
and passing
a value like QSystemTrayIcon.Information
.
https://github.com/DevDungeon/PyQt5-Bitcoin-Price-Checker DevDungeon/PyQt5-Bitcoin-Price-Checker#1
Building for Android: https://medium.com/@Lola_Dam/packaging-pyqt-application-using-pyqtdeploy-for-both-linux-and-android-32ac7824708b