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 DearPyGUI.
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 need!
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 ready to use to develop real-world apps. In shorts: P4D gives you various real-world “Hello World!” apps that 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, Demo17: Using variant arrays of 2 dimensions:
And let’s try another interesting Demo, Demo33: Using Threads inside Python:
2. Dear PyGUI
Dear PyGui is a simple to use, but powerful Python GUI framework. Dear PyGui provides a wrapping of Dear ImGui that simulates a traditional retained-mode GUI, as opposed to Dear ImGui’s immediate mode paradigm.
Under the hood, Dear PyGui uses the immediate mode paradigm allowing for extremely dynamic interfaces. Similar to PyQt, Dear PyGui does not use native widgets but instead draws the widgets using your computer’s graphics card (using Directx11, Metal, and Vulkan rendering APIs).
In the same manner, Dear ImGui provides a simple way to create tools for Game Developers, Dear PyGui provides a simple way for Python Developers to create quick and powerful GUIs for scripts.
When compared with other Python GUI libraries, Dear PyGui is unique with:
- GPU Rendering
- Simple built-in Asynchronous function support
- Complete theme and style control
- Simple built-in logging window
- 70+ widgets with hundreds of widget combinations
- Detailed documentation, examples, and unparalleled support
How can we use Dear PyGUI?
The steps for using the GUI package Dear PyGUI are:
- Install Dear PyGUI using pip or easy install:
pip install dearpygui
See the installation progress in your command prompt:
2. Creating a Simple GUI with Plots
Let’s create a simple GUI app with a line graph and histogram plots on it.
This simple plots demo take in a list and plot y-axis data against the number of items in the list. These can be line graphs or histograms and are demonstrated below:
from dearpygui.core import *
from dearpygui.simple import *
with window("Tutorial", width=500, height=500):
add_simple_plot("Simpleplot1", value=[0.3, 0.9, 0.5, 0.3], height=300)
add_simple_plot("Simpleplot2", value=[0.3, 0.9, 2.5, 8.9], overlay="Overlaying", height=180, histogram=True)
Run it in our PyScripter IDE:
The simple plots GUI:
Congratulations, you already learn the amazing example of GUI development by Python4Delphi vs Dear PyGUI!
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.