RAD Studio Comparison: Python For Delphi VCL vs PySimpleGUI

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,199
Credits
4,009
Comparison: Python For Delphi VCL vs PySimpleGUI
February 15, 2021 By Muhammad Azizul Hakim

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 PySimpleGUI.

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.

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:
1613404691837.png
Demo01 to Run any Python Scripts on Delphi.

Python REST Client:
1613404707974.png
Read image and perform Image Processing with Python Imaging Library (PIL):
1613404718951.png

2. PySimpleGUI​

PySimpleGUI is easy to use with simple yet HIGHLY customizable features of GUI for Python. It is based solely on Tkinter. It is a Python GUI designed for humans that Transforms Tkinter, PyQt, Remi, WxPython into portable user-friendly Pythonic interfaces.

How can we use PySimpleGUI?​

The Steps for using the GUI package PySimpleGUI are:
  1. Install PySimpleGUI using pip or easy install:
Код:
pip install PySimpleGUI
See the installation progress in your command line:
1613404758220.png
2. Find a GUI that looks a lot similar to which you want to design and create.
3. Copy code from Cookbook or documentations.
4. Paste into your IDE and run. Here’s the example that I run in the PyScripter IDE:
Python:
import PySimpleGUI as sg
  
      
sg.theme('BluePurple')
  
layout = [[sg.Text('Your typed characters appear here:'),
           sg.Text(size=(15,1), key='-OUTPUT-')],
          [sg.Input(key='-IN-')],
          [sg.Button('Display'), sg.Button('Exit')]]
 
window = sg.Window('Introduction', layout)
 
while True:
    event, values = window.read()
    print(event, values)
      
    if event in  (None, 'Exit'):
        break
      
    if event == 'Display':
        # Update the "output" text element
        # to be the value of "input" element
        window['-OUTPUT-'].update(values['-IN-'])
 
window.close()
See how it looks like in PyScripter IDE:
1613404796480.png
See our created GUI by PySimpleGUI:
1613404807980.png