Are you an expert in desktop apps and GUI development who want to also work with Python because of its simplicity, flexible use, and growing demand in the market out there? Or are you a Python Developer at any level who wants to start a GUI development journey? This article is for you.
We will review the two examples of the most powerful Python Desktop App and GUI Frameworks: Python For Delphi (P4D) VCL vs Python GUI Generator: wxGlade.
Table of Contents
1. Python For Delphi VCL
How about combining the strength of GUI and desktop app development by Delphi with Python for your applications, to provide first-class solutions for your customer needs? Python4Delphi is the answer to your needs!
Python for Delphi (P4D) is a set of free components that wrap up the Python DLL into Delphi and Lazarus (FPC). They let you easily execute Python scripts, and powerfully create new Python modules and new Python types.
The best advantage of P4D is, it makes it very easy to use Python as a scripting language for Delphi applications that comes with a very extensive range of customizable demos and tutorials that are ready to use to develop real-world apps. In shorts: P4D gives you various real-world “Hello World!” apps that are ready to adjust to your needs!
Prerequisites: Before you begin to work with Python4Delphi VCL, download and install the latest Python for your platform. Follow the Python4Delphi installation instructions mentioned here. Alternatively, you can check out the easy instructions found in this video Getting started with Python4Delphi and the behind the scene details of how Delphi manages to run your Python code in this amazing Python GUI can be found at this link.
Here are some working example of it, runs on RAD Studio:
Let’s try this interesting Demo, Demo01: A simple GUI to run any Python scripts rapidly:
2. Python GUI Generator: wxGlade
wxGlade is a GUI designer written in Python with the popular GUI toolkit wxPython, that helps you create WxWidgets/ WxPython user interfaces. At the moment it can generate Python, C++, and XRC (WxWidgets’ XML resources) code.
As you can guess by the name, its model is Glade, the famous GTK+/GNOME GUI builder, with which wxGlade shares the philosophy and the look & feel (but not a line of code).
2.1. How can we use Python GUI Generator: wxGlade?
The steps for using the GUI package wxPython are:
- Install wxPython using pip or easy install:
1 |
pip install wxpython |
See the installation progress in your command prompt:
2. To start the program, change the directory to the installation directory of wxGlade:
C:/Users/UserName/AppData/Local/Programs/Python/Python38/Lib/site-packages/wxGlade-1.0.1
3. And run:
1 |
python wxglade.py |
in your command prompt. Here is the screenshot:
And finally, the wxGlade window will appear:
4. Browse and try interesting examples
Let’s try the Calendar GUI example by navigating to:
C:/Users/ASUS/AppData/Local/Programs/Python/Python38/Lib/site-packages/wxGlade-1.0.1/examples/, and run this command:
1 |
python Calculator.py |
This Calendar GUI will show up:
5. Try another example:
Let’s try the Matplotlib GUI example by navigating to:
C:/Users/ASUS/AppData/Local/Programs/Python/Python38/Lib/site-packages/wxGlade-1.0.1/examples/matplotlib3/, and run this command:
1 |
python matplotlib_example.py |
This Matplotlib GUI will show up:
Conclusion
Congratulations, you already learned the amazing example of GUI development by Python4Delphi vs Python GUI Generator: wxGlade!
Now it’s time for you to try it yourself, and please comment below for which one is your favorite that best suits your needs!
Check out Python4Delphi which easily allows you to build Python GUIs for Windows using Delphi.