Delphi Compare Python For Delphi VCL vs Dear PyGUI For Windows Apps

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,203
Credits
4,034
Compare Python For Delphi VCL vs Dear PyGUI For Windows Apps
By Muhammad Azizul Hakim March 13, 2021

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.

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 Для просмотра ссылки Войди или Зарегистрируйся for your platform. Follow the Для просмотра ссылки Войди или Зарегистрируйся installation instructions mentioned Для просмотра ссылки Войди или Зарегистрируйся. Alternatively, you can check out the easy instructions found in this video Для просмотра ссылки Войди или Зарегистрируйся 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 Для просмотра ссылки Войди или Зарегистрируйся.

Here are some working example of it, runs on RAD Studio:
1615639797292.png
Demo01 to Run any Python Scripts on Delphi.

Let’s try this interesting Demo, Demo17: Using variant arrays of 2 dimensions:
1615639809782.png
Demo17: Using Variant Arrays of 2 Dimensions.

And let’s try another interesting Demo, Demo33: Using Threads inside Python:
1615639820755.png
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:
  1. Install Dear PyGUI using pip or easy install:
Python:
pip install dearpygui
See the installation progress in your command prompt:
1615639863585.png
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:
Python:
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)
 
start_dearpygui()
Run it in our PyScripter IDE:
1615639898380.png
The simple plots GUI:
1615639912191.png

Conclusion​

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!