Using the fman build system
Table of contents
A quick run through of using the fman build system (fbs). They have a great tutorial online, but this will be a little more focused on creating a full app.
The fbs build system only supports Python version 3.5 or 3.6 and requires a specific version of PyQt5 (5.9.2) and PyInstaller (3.4).
- Install Qt Designer, either from qt, or from the fbs site. Run Qt Designer and make the UI to match your needs.
- Install fbs and PyQt5
python -m pip install fbs PyQt5==5.9.2
-
To get your PyQt app running under fbs, there is two main things that need to be done.
- You need to have an application context provided by fbs
from fbs_runtime.application_context.PyQt5 import ApplicationContext appctxt = ApplicationContext()
- Run the PyQt app from the application context
appctxt.app.exec_()
- Try
fbs startproject
to see what is expected to be in your full project. - If on windows you will probably need to install win32
python -m pip install pypiwin32
- Run using
fbs run
or create an installer for the app withfbs freeze
followed byfbs installer
.
The fman build system comes with many great features, such as using the get_resource
function on the application context to find resources in a very easy and replicable manner.
Troubleshooting
The build system has its own troubleshooting guide. Here is an extra thing in case running the executable gives a failed to execute script pyi-rth-pkgres. There are many fixes available, but the easiest one when using fbs is to just add an unused import to your main file import pkg_resources.py2_warn
. Usually you would add this as hidden import, but I’m not entirely sure how to do this in fbs.
Also, don’t forget that on Windows you need NSIS on PATH to create an installer.
(Photo by Moritz Mentges on Unsplash)