In this Python beginner tutorials series, a step-by-step guide is giving to create an Windows executable (.exe), based Python. The GUI (Graphical User Interface) is created with QtDesigner and managed in PyQt. At the end, the Python code is transformed to a Windows .exe, such that it can be deployed to users without requiring a Python installation.
This series uses PyQt, however afterwards it seemed only natural to switch to Pyside2. Switching is quite easy, as both libraries are quite similar. For more information about the difference and how to switch is explained in this post by Martin Fitzpatrick.
The series is meant for Python and Qt beginners and does not require any previous experience with these languages. However, the reader is expected to be familiar with coding basics. Variables, data types, functions and classes will not be explained in detail. If you need more information on the coding basics, feel free to send me an email.
The project is split up in a series of articles. In this series, we'll create an image-proccessing program based on Pillow. The program will allow us to select a folder, after which the code creates new directories and processes the images found. For each image, Pillow creates a small thumbnail and a larger watermarked image. While doing this, the progress is communicated with the user by a re-usable process logger and updated progress bar. The processing and logger will be separated on different processing threads using Qthread. Finally, an executable is made using PyInstaller, such that the program can be deployed without requiring Python installation. Before starting coding, we'll install Python and QtDesigner, pip install the required libraries (PyQt, Pillow, logging, Path) and setup Notepad++ as the text editor. In this series you'll learn:
- How to install Python and Python libraries
- How to run Python from within Notepad++
- How to use QtDesigner to created a GUI
- How to use Python's library PyQt (or PySide 2 as explained earlier) to interact with the GUI and load .ui files in Python
- Create a stand-alone QWidget consisting of a progress logger and progress bar and interacting with the logging library
- Create a QMainWindow and incorporate stand-alone widgets in it
- Use Python's library Path to easily manage directory and files paths
- Use Python's library Pillow to create thumbnails and watermark images.
- Create a Windows Executable (.exe) using PyInstaller, which allows the code to be deployed on machines without having Python installed.
Overview of articles
Although the program is already finished, I still have to write most of the articles. Are you eager to read the unfinished articles? Send me mail! Below is an overview and the links to the different articles. Those marked [UNFINISHED] are not available yet.
- [UNFINISHED] Installing Python and QtDesigner
- [UNFINISHED] Overview of the used Pyton Libraries and installing them using PIP
- Running and debugging Python from within our text editor Notepad++
- [UNFINISHED] Overview of QtDesigner
- [UNFINISHED] Qt toPython using PyQt (or PySide2) by load or pyuic bat file
- [UNFINISHED] Python Progress logger: creating the GUI in QtDesigner
- [UNFINISHED] Python Progress logger: log errors and progress using logging
- [UNFINISHED] Python Progress logger: updating a QProgressbar
- [UNFINISHED] Python Image editor: creating the GUI in QtDesigner and incorporate a stand-alone QWidget
- [UNFINISHED] Python Image editor: using Path and Glob to manage directories and files
- [UNFINISHED] Python Image editor: separating processes using QThread
- [UNFINISHED] Python Image editor: create thumbnails and watermark images using Pillow
- [UNFINISHED] Python standalone executable: using PyInstaller to create a exe for deployment