This article shows how to program a Linux GUI. In five minutes from now, you will have created an app and a downloadable installer. We'll build the following GUI, but you can also create any other:
You need Python 3 and Docker. Your users on the other hand won't need any of the two.
To start, open a Terminal and change to an empty directory. We will use a Python virtual environment to hold your project's dependencies. Create it via the following command:
python3 -m venv venv
Then, activate the virtual environment:
You can verify this was successful by the
(venv) prefix in your shell:
With the virtual environment still active, install the following Python dependencies:
pip install fbs PyInstaller==3.4 PyQt5==5.9.2
fbs startproject. This asks you a few
questions. Pick any values you like:
When you follow the suggestion and enter
fbs run, a little window should appear:
Let's add some contents to it. Replace
src/main/python/main.py in your current
When you then do
fbs run again, you should see
Okay. Now enter the following commands:
fbs gengpgkey fbs register fbs buildvm ubuntu # or `arch` / `fedora` fbs runvm ubuntu # In the VM: fbs release
Some of the commands take a long time. But once finished, you should get instructions how anyone on your chosen Linux distribution can install your app. 4:53. Phew!
We used fbs to create
a simple Linux GUI. It is a library for deploying
applications based on Python and Qt (a GUI framework). So:
main.py script invoked Qt, which then
showed the window on your screen. fbs's job was to turn
main.py into a standalone executable and a
It hopefully looked easy. But without fbs, the above would
have taken weeks instead of minutes. Especially with
automatic updates, which fbs - and thus your app - already
supports. And here's what's really cool: Replace
fedora above to immediately support other
distributions. This simplicity could enable a whole new
generation of cross-distro Linux applications. (Related:
AppImage support in fbs.)
fbs was originally created for the cross-platform file manager fman. In addition to Linux, fbs also supports Mac and Windows. It is open source under the GPL, with the code hosted on GitHub. If the GPL is too restrictive for you, then you can also obtain a commercial license.
The hosting of your binaries is free for now. If you need certain assurances with regards to hosting or want to self-host, please get in touch. Also feel free to reach out with any questions or comments you might have.
Finally, you may wonder where to go from here. To learn more about Python and Qt, check out this PyQt5 tutorial. For more about how fbs works - including on Windows and macOS - see its official tutorial. Or maybe you already have a Python/Qt app. Then this guide may help you.
In any case – enjoy!