SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
Python for Delphi
Developers (Part II)
Webinar by Kiriakos Vlahos (aka PyScripter)
and Jim McKeeth (Embarcadero)
Contents
•VarPyth
Using python libraries and objects in Delphi code
•Core libraries
•Visualization
•Machine Learning
Python based data analytics in Delphi applications
•TPythonThread
Running python scripts without blocking your GUI
Creating Python extension modules using Delphi
•WrapDelphi and WrapDelphiVCL units
Python GUI development using the VCL
VarPyth
• High-level access to python objects from Delphi code
• It also allows you to create common python objects (lists, tuples etc.)
• Uses custom variants
• No need to use the low-level python API or deal with python object reference
counting
• Small performance penalty
• Example
• ShowMessage(SysModule.version)
• Explore Demo25 and the VarPyth unit tests
VarPyth Demoprocedure TForm1.FormCreate(Sender: TObject);
begin
var np := Import('numpy');
var np_array: Variant :=
np.array(VarPythonCreate([1,2,3,4,5,6,7,8,9,10]));
PythonModule.SetVar('np_array’,
ExtractPythonObjectFrom(np_array));
end;
Python code:
from delphi_module import np_array
print("type(np_array) = ", type(np_array))
print("len(np_array) = ", len(np_array))
print("np_array = ", np_array)
res_array = np_array.copy()
for i in range(len(np_array)):
res_array[i] *= np_array[i]
print("res_array = ", res_array)
Output:
type(np_array) = <class 'numpy.ndarray'>
len(np_array) = 10
np_array = [ 1 2 3 4 5 6 7 8 9 10]
res_array = [ 1 4 9 16 25 36 49 64 81 100]
procedure TForm1.btnRunClick(Sender: TObject);
begin
GetPythonEngine.ExecString(UTF8Encode(sePythonCode.Text));
for var V in VarPyIterate(MainModule.res_array) do
ListBox.Items.Add(V);
end;
To learn more, explore Demo25 and the VarPyth unit tests
Core Python Libraries
• Core libraries
• numpy – arrays and matrix algebra
• scipy – math, science and engineering
• pandas – data structure and analysis, R-like dataframes
• Data visualization
• matplotlib – matlab-like plotting
• seaborn – statistical data visualization
• mpld3 – turn matplotlib plots into interactive web pages
• bokeh - interactive visualization library for modern browsers
• plotly – interactive browser-based graphing library
• altair – based on the visualization grammar vega-light
Data visualization
Demos - pyVIZsvg
• Create charts with python
libraries, save them in svg
format and plot them in Delphi
• Uses matplotlib and seaborn
python libraries
• Uses TSVGIconImage from
EtheaDev SVGIconImageList
components
Interactive Data
Visualization Demo -
PychartHtml
• Create interactive charts in
python save them to html and
show them inside Delphi
applications
• Showcases the new
TEdgeBrowser
• Uses the matplotlib with mpld3,
altair and bohek python
libraries
Machine Learning Python Libraries
• tensorflow (Google)
• keras – high level pythonic interface
• PyTorch (Facebook)
• CNTK - The Microsoft Cognitive Toolkit (Microsoft)
• Spark MLlib and mxnet (Apache Foundation)
• scikit-learn
• pure-python, general library, wide coverage, good choice for newcomers to
ML/AI
Data Analytics Demo:
COVID-19
• Demonstrates the combined use of numpy,
pandas, matplotlib and scikit-learn
• Use pandas to download Covid-19 confirmed
cases data from Web and aggregate it
• Use scikit-learn to
• Split the data into training and test sets
• Transform the data
• Define model (Bayesian Ridge Regression)
• Optimize model parameters
• Generate predictions
• Use matplotlib to compare actual vrs fitted test
data.
Running Python Scripts Without
Blocking Your Main Thread
• Python uses the infamous Global Interpreter Lock (GIL)
• This means that only one thread can run python code at any given time
• Python switches between python created threads automatically
• Applications using python need to acquire the GIL before running python
code and release it soon afterwards
• Welcome to TPythonThread
• TThread descendent
• Automatically acquires and releases the GIL
Python threads –
demo33
• Shows you how to
• use TPythonThread
• use new sub-interpreters
• synchronize with the main
thread
• interrupt running threads
with a keyboard interrupt
exception
Technical Aside I
• FPU Exception mask
• Delphi’s default FPU exception mask is different from most other Windows apps
• Incompatible with python libraries written in C or C++
• If you use numpy, scipy, tensorflow etc. you need to match the FPU mask they
expect to operate with
• PythonEngine.pas provides a function for doing that: MaskFPUExceptions
• Call MaskFPUExceptions(True) before python is loaded
• e.g. the initialization section of your main form
• See the P4D Wiki page for details
Technical Aside II
• Working with different python distributions:
• P4D makes a good effort to discover registered python distributions automatically
• But sometimes you want to use python distributions which are not registered
• One such case is when want to deploy your application bundled with python.
Python.org offers such a minimal distribution for applications embedding python.
• Additional considerations apply when using an Anaconda distribution
• Read the Finding Python P4D Wiki page carefully
P4D Python Extension Modules
• Python extension modules are dynamic link libraries that can be used by
python in a way similar to modules developed in python.
• They have ‘pyd’ extension.
• P4D makes it very easy to create extension modules that contain functions
and types developed in Delphi.
• These extension modules can be used by Python, independently of Delphi,
and can be packaged with setuptools and distributed through PyPi.
Python extension modules Demo
function PyInit_DemoModule: PPyObject;
//function exported by dll – initializes the module
begin
try
gEngine := TPythonEngine.Create(nil);
gEngine.AutoFinalize := False;
gEngine.UseLastKnownVersion := False;
// Adapt to the desired python version
gEngine.RegVersion := '3.8';
gEngine.DllName := 'python38.dll';
gModule := TPythonModule.Create(nil);
gModule.Engine := gEngine;
gModule.ModuleName := 'DemoModule';
gModule.AddMethod('is_prime', delphi_is_prime,
'is_prime(n) -> bool' );
gEngine.LoadDll;
except
end;
Result := gModule.Module;
end;
Python test module: test.py
from DemoModule import is_prime
from timeit import Timer
def count_primes(max_n):
res = 0
for i in range(2, max_n + 1):
if is_prime(i):
res += 1
return res
Command line:
> C:PythonPython38python test.py
Number of primes between 0 and 1000000 = 78498
Elapsed time: 0.29756570000000004 secs
Wrapping VCL as a Python
Extension Module I
• We can use the same approach to create an extension module wrapping
VCL
• Uses the WrapDelphi and WrapDelphiVCL units
• The whole of VCL (almost) is wrapped in 40 lines of code
• The generated Delphi.pyd file is only 5Mbs
• It can be uses to create VCL-based GUIs in python without needing Delphi
• A similar approach could be used to wrap FMX and create a multi-platform
python GUI library
• Unclear whether there are licensing restrictions in distributing such a file
Wrapping VCL as a Python
Extension Module II
unit uMain;
interface
uses PythonEngine;
function PyInit_Delphi: PPyObject; cdecl;
implementation
uses WrapDelphi, WrapDelphiVCL;
// similar to the previous extension module
TestApp.py
from Delphi import *
class MainForm(Form):
def __init__(self, Owner):
self.Caption = "A Delphi Form..."
self.SetBounds(10, 10, 500, 400)
self.lblHello = Label(self)
self.lblHello.SetProps(Parent=self, Caption="Hello World")
self.lblHello.SetBounds(10, 10, 300, 24)
self.OnClose = self.MainFormClose
def MainFormClose(self, Sender, Action):
Action.Value = caFree
def main():
Application.Initialize()
Application.Title = "MyDelphiApp"
f = MainForm(Application)
f.Show()
FreeConsole()
Application.Run()
main()
Command line:
> C:PythonPython38python .TestApp.py
Summary
• With Python for Delphi you can get the best of both worlds
• P4D makes it very easy to integrate Python into Delphi applications in RAD
way, thus providing access to a vast range of python libraries
• Expose Delphi function, objects, records and types to Python using low or
high-level interfaces (WrapDelphi)
• Create/Access/Use Python objects/modules in your Delphi code using a high-
level interface (VarPyth)
• Run python code in threads
• Create python extensions modules
• Wrap Vcl as a Python extension module to create GUIs with python
github.com/pyscripter/python4delphi/tree/master/Tutorials/Webinar%20II

Weitere ähnliche Inhalte

Was ist angesagt?

The Joy of SciPy
The Joy of SciPyThe Joy of SciPy
The Joy of SciPykammeyer
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkFabio Tiriticco
 
Introduction of eBPF - 時下最夯的Linux Technology
Introduction of eBPF - 時下最夯的Linux Technology Introduction of eBPF - 時下最夯的Linux Technology
Introduction of eBPF - 時下最夯的Linux Technology Jace Liang
 
Quickboot on i.MX6
Quickboot on i.MX6Quickboot on i.MX6
Quickboot on i.MX6Gary Bisson
 
Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedureDhaval Kaneria
 
Launch the First Process in Linux System
Launch the First Process in Linux SystemLaunch the First Process in Linux System
Launch the First Process in Linux SystemJian-Hong Pan
 
Fundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege EscalationFundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege Escalationnullthreat
 
Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...
Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...
Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...Anne Nicolas
 
Linux Performance Analysis and Tools
Linux Performance Analysis and ToolsLinux Performance Analysis and Tools
Linux Performance Analysis and ToolsBrendan Gregg
 
Linux System Programming - File I/O
Linux System Programming - File I/O Linux System Programming - File I/O
Linux System Programming - File I/O YourHelper1
 
Python Crash Course
Python Crash CoursePython Crash Course
Python Crash CourseHaim Michael
 

Was ist angesagt? (20)

Linux Programming
Linux ProgrammingLinux Programming
Linux Programming
 
The Joy of SciPy
The Joy of SciPyThe Joy of SciPy
The Joy of SciPy
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! Framework
 
Linux
Linux Linux
Linux
 
Linux scheduler
Linux schedulerLinux scheduler
Linux scheduler
 
Introduction of eBPF - 時下最夯的Linux Technology
Introduction of eBPF - 時下最夯的Linux Technology Introduction of eBPF - 時下最夯的Linux Technology
Introduction of eBPF - 時下最夯的Linux Technology
 
Quickboot on i.MX6
Quickboot on i.MX6Quickboot on i.MX6
Quickboot on i.MX6
 
Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedure
 
Welcome_to_Python.pptx
Welcome_to_Python.pptxWelcome_to_Python.pptx
Welcome_to_Python.pptx
 
Basic openfoa mtutorialsguide
Basic openfoa mtutorialsguideBasic openfoa mtutorialsguide
Basic openfoa mtutorialsguide
 
Launch the First Process in Linux System
Launch the First Process in Linux SystemLaunch the First Process in Linux System
Launch the First Process in Linux System
 
Fundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege EscalationFundamentals of Linux Privilege Escalation
Fundamentals of Linux Privilege Escalation
 
Linux Kernel Overview
Linux Kernel OverviewLinux Kernel Overview
Linux Kernel Overview
 
Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...
Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...
Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...
 
Architecture Of The Linux Kernel
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernel
 
Linux Performance Analysis and Tools
Linux Performance Analysis and ToolsLinux Performance Analysis and Tools
Linux Performance Analysis and Tools
 
Linux System Programming - File I/O
Linux System Programming - File I/O Linux System Programming - File I/O
Linux System Programming - File I/O
 
Python Crash Course
Python Crash CoursePython Crash Course
Python Crash Course
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 
AndroidとSELinux
AndroidとSELinuxAndroidとSELinux
AndroidとSELinux
 

Ähnlich wie Python for Delphi Developers - Part 2

Python indroduction
Python indroductionPython indroduction
Python indroductionFEG
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4Max Kleiner
 
Anaconda Python KNIME & Orange Installation
Anaconda Python KNIME & Orange InstallationAnaconda Python KNIME & Orange Installation
Anaconda Python KNIME & Orange InstallationGirinath Pillai
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Max Kleiner
 
PyCourse - Self driving python course
PyCourse - Self driving python coursePyCourse - Self driving python course
PyCourse - Self driving python courseEran Shlomo
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Fwdays
 
Development_C_Extension_with_Pybind11.pdf
Development_C_Extension_with_Pybind11.pdfDevelopment_C_Extension_with_Pybind11.pdf
Development_C_Extension_with_Pybind11.pdfTakayuki Suzuki
 
Using SWIG to Control, Prototype, and Debug C Programs with Python
Using SWIG to Control, Prototype, and Debug C Programs with PythonUsing SWIG to Control, Prototype, and Debug C Programs with Python
Using SWIG to Control, Prototype, and Debug C Programs with PythonDavid Beazley (Dabeaz LLC)
 
OpenSAF Symposium_Python Bindings_9.21.11
OpenSAF Symposium_Python Bindings_9.21.11OpenSAF Symposium_Python Bindings_9.21.11
OpenSAF Symposium_Python Bindings_9.21.11OpenSAF Foundation
 
Python for security professionals by katoh jeremiah [py con ng 2018]
Python for security professionals by katoh jeremiah [py con ng 2018]Python for security professionals by katoh jeremiah [py con ng 2018]
Python for security professionals by katoh jeremiah [py con ng 2018]jerrykatoh
 
PyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsPyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsHenry Schreiner
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioMuralidharan Deenathayalan
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioMuralidharan Deenathayalan
 
Python testing like a pro by Keith Yang
Python testing like a pro by Keith YangPython testing like a pro by Keith Yang
Python testing like a pro by Keith YangPYCON MY PLT
 
Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Mohan Arumugam
 
Fluo CICD OpenStack Summit
Fluo CICD OpenStack SummitFluo CICD OpenStack Summit
Fluo CICD OpenStack SummitMiguel Zuniga
 

Ähnlich wie Python for Delphi Developers - Part 2 (20)

Python indroduction
Python indroductionPython indroduction
Python indroduction
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4
 
Anaconda Python KNIME & Orange Installation
Anaconda Python KNIME & Orange InstallationAnaconda Python KNIME & Orange Installation
Anaconda Python KNIME & Orange Installation
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475
 
PyCourse - Self driving python course
PyCourse - Self driving python coursePyCourse - Self driving python course
PyCourse - Self driving python course
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"
 
Development_C_Extension_with_Pybind11.pdf
Development_C_Extension_with_Pybind11.pdfDevelopment_C_Extension_with_Pybind11.pdf
Development_C_Extension_with_Pybind11.pdf
 
Python Tutorial Part 2
Python Tutorial Part 2Python Tutorial Part 2
Python Tutorial Part 2
 
Using SWIG to Control, Prototype, and Debug C Programs with Python
Using SWIG to Control, Prototype, and Debug C Programs with PythonUsing SWIG to Control, Prototype, and Debug C Programs with Python
Using SWIG to Control, Prototype, and Debug C Programs with Python
 
OpenSAF Symposium_Python Bindings_9.21.11
OpenSAF Symposium_Python Bindings_9.21.11OpenSAF Symposium_Python Bindings_9.21.11
OpenSAF Symposium_Python Bindings_9.21.11
 
Python for security professionals by katoh jeremiah [py con ng 2018]
Python for security professionals by katoh jeremiah [py con ng 2018]Python for security professionals by katoh jeremiah [py con ng 2018]
Python for security professionals by katoh jeremiah [py con ng 2018]
 
PySide
PySidePySide
PySide
 
PyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsPyCon2022 - Building Python Extensions
PyCon2022 - Building Python Extensions
 
Interfacing C/C++ and Python with SWIG
Interfacing C/C++ and Python with SWIGInterfacing C/C++ and Python with SWIG
Interfacing C/C++ and Python with SWIG
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
 
PyData Boston 2013
PyData Boston 2013PyData Boston 2013
PyData Boston 2013
 
Python testing like a pro by Keith Yang
Python testing like a pro by Keith YangPython testing like a pro by Keith Yang
Python testing like a pro by Keith Yang
 
Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)Python-Yesterday Today Tomorrow(What's new?)
Python-Yesterday Today Tomorrow(What's new?)
 
Fluo CICD OpenStack Summit
Fluo CICD OpenStack SummitFluo CICD OpenStack Summit
Fluo CICD OpenStack Summit
 

Mehr von Embarcadero Technologies

PyTorch for Delphi - Python Data Sciences Libraries.pdf
PyTorch for Delphi - Python Data Sciences Libraries.pdfPyTorch for Delphi - Python Data Sciences Libraries.pdf
PyTorch for Delphi - Python Data Sciences Libraries.pdfEmbarcadero Technologies
 
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...Embarcadero Technologies
 
Linux GUI Applications on Windows Subsystem for Linux
Linux GUI Applications on Windows Subsystem for LinuxLinux GUI Applications on Windows Subsystem for Linux
Linux GUI Applications on Windows Subsystem for LinuxEmbarcadero Technologies
 
Python on Android with Delphi FMX - The Cross Platform GUI Framework
Python on Android with Delphi FMX - The Cross Platform GUI Framework Python on Android with Delphi FMX - The Cross Platform GUI Framework
Python on Android with Delphi FMX - The Cross Platform GUI Framework Embarcadero Technologies
 
FMXLinux Introduction - Delphi's FireMonkey for Linux
FMXLinux Introduction - Delphi's FireMonkey for LinuxFMXLinux Introduction - Delphi's FireMonkey for Linux
FMXLinux Introduction - Delphi's FireMonkey for LinuxEmbarcadero Technologies
 
RAD Industrial Automation, Labs, and Instrumentation
RAD Industrial Automation, Labs, and InstrumentationRAD Industrial Automation, Labs, and Instrumentation
RAD Industrial Automation, Labs, and InstrumentationEmbarcadero Technologies
 
Embeddable Databases for Mobile Apps: Stress-Free Solutions with InterBase
Embeddable Databases for Mobile Apps: Stress-Free Solutions with InterBaseEmbeddable Databases for Mobile Apps: Stress-Free Solutions with InterBase
Embeddable Databases for Mobile Apps: Stress-Free Solutions with InterBaseEmbarcadero Technologies
 
Rad Server Industry Template - Connected Nurses Station - Setup Document
Rad Server Industry Template - Connected Nurses Station - Setup DocumentRad Server Industry Template - Connected Nurses Station - Setup Document
Rad Server Industry Template - Connected Nurses Station - Setup DocumentEmbarcadero Technologies
 
Move Desktop Apps to the Cloud - RollApp & Embarcadero webinar
Move Desktop Apps to the Cloud - RollApp & Embarcadero webinarMove Desktop Apps to the Cloud - RollApp & Embarcadero webinar
Move Desktop Apps to the Cloud - RollApp & Embarcadero webinarEmbarcadero Technologies
 
Getting Started Building Mobile Applications for iOS and Android
Getting Started Building Mobile Applications for iOS and AndroidGetting Started Building Mobile Applications for iOS and Android
Getting Started Building Mobile Applications for iOS and AndroidEmbarcadero Technologies
 
ER/Studio 2016: Build a Business-Driven Data Architecture
ER/Studio 2016: Build a Business-Driven Data ArchitectureER/Studio 2016: Build a Business-Driven Data Architecture
ER/Studio 2016: Build a Business-Driven Data ArchitectureEmbarcadero Technologies
 
The Secrets of SQL Server: Database Worst Practices
The Secrets of SQL Server: Database Worst PracticesThe Secrets of SQL Server: Database Worst Practices
The Secrets of SQL Server: Database Worst PracticesEmbarcadero Technologies
 
Driving Business Value Through Agile Data Assets
Driving Business Value Through Agile Data AssetsDriving Business Value Through Agile Data Assets
Driving Business Value Through Agile Data AssetsEmbarcadero Technologies
 
Troubleshooting Plan Changes with Query Store in SQL Server 2016
Troubleshooting Plan Changes with Query Store in SQL Server 2016Troubleshooting Plan Changes with Query Store in SQL Server 2016
Troubleshooting Plan Changes with Query Store in SQL Server 2016Embarcadero Technologies
 
Agile, Automated, Aware: How to Model for Success
Agile, Automated, Aware: How to Model for SuccessAgile, Automated, Aware: How to Model for Success
Agile, Automated, Aware: How to Model for SuccessEmbarcadero Technologies
 
What's New in DBArtisan and Rapid SQL 2016
What's New in DBArtisan and Rapid SQL 2016What's New in DBArtisan and Rapid SQL 2016
What's New in DBArtisan and Rapid SQL 2016Embarcadero Technologies
 

Mehr von Embarcadero Technologies (20)

PyTorch for Delphi - Python Data Sciences Libraries.pdf
PyTorch for Delphi - Python Data Sciences Libraries.pdfPyTorch for Delphi - Python Data Sciences Libraries.pdf
PyTorch for Delphi - Python Data Sciences Libraries.pdf
 
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
 
Linux GUI Applications on Windows Subsystem for Linux
Linux GUI Applications on Windows Subsystem for LinuxLinux GUI Applications on Windows Subsystem for Linux
Linux GUI Applications on Windows Subsystem for Linux
 
Python on Android with Delphi FMX - The Cross Platform GUI Framework
Python on Android with Delphi FMX - The Cross Platform GUI Framework Python on Android with Delphi FMX - The Cross Platform GUI Framework
Python on Android with Delphi FMX - The Cross Platform GUI Framework
 
FMXLinux Introduction - Delphi's FireMonkey for Linux
FMXLinux Introduction - Delphi's FireMonkey for LinuxFMXLinux Introduction - Delphi's FireMonkey for Linux
FMXLinux Introduction - Delphi's FireMonkey for Linux
 
RAD Industrial Automation, Labs, and Instrumentation
RAD Industrial Automation, Labs, and InstrumentationRAD Industrial Automation, Labs, and Instrumentation
RAD Industrial Automation, Labs, and Instrumentation
 
Embeddable Databases for Mobile Apps: Stress-Free Solutions with InterBase
Embeddable Databases for Mobile Apps: Stress-Free Solutions with InterBaseEmbeddable Databases for Mobile Apps: Stress-Free Solutions with InterBase
Embeddable Databases for Mobile Apps: Stress-Free Solutions with InterBase
 
Rad Server Industry Template - Connected Nurses Station - Setup Document
Rad Server Industry Template - Connected Nurses Station - Setup DocumentRad Server Industry Template - Connected Nurses Station - Setup Document
Rad Server Industry Template - Connected Nurses Station - Setup Document
 
TMS Google Mapping Components
TMS Google Mapping ComponentsTMS Google Mapping Components
TMS Google Mapping Components
 
Move Desktop Apps to the Cloud - RollApp & Embarcadero webinar
Move Desktop Apps to the Cloud - RollApp & Embarcadero webinarMove Desktop Apps to the Cloud - RollApp & Embarcadero webinar
Move Desktop Apps to the Cloud - RollApp & Embarcadero webinar
 
Useful C++ Features You Should be Using
Useful C++ Features You Should be UsingUseful C++ Features You Should be Using
Useful C++ Features You Should be Using
 
Getting Started Building Mobile Applications for iOS and Android
Getting Started Building Mobile Applications for iOS and AndroidGetting Started Building Mobile Applications for iOS and Android
Getting Started Building Mobile Applications for iOS and Android
 
Embarcadero RAD server Launch Webinar
Embarcadero RAD server Launch WebinarEmbarcadero RAD server Launch Webinar
Embarcadero RAD server Launch Webinar
 
ER/Studio 2016: Build a Business-Driven Data Architecture
ER/Studio 2016: Build a Business-Driven Data ArchitectureER/Studio 2016: Build a Business-Driven Data Architecture
ER/Studio 2016: Build a Business-Driven Data Architecture
 
The Secrets of SQL Server: Database Worst Practices
The Secrets of SQL Server: Database Worst PracticesThe Secrets of SQL Server: Database Worst Practices
The Secrets of SQL Server: Database Worst Practices
 
Driving Business Value Through Agile Data Assets
Driving Business Value Through Agile Data AssetsDriving Business Value Through Agile Data Assets
Driving Business Value Through Agile Data Assets
 
Troubleshooting Plan Changes with Query Store in SQL Server 2016
Troubleshooting Plan Changes with Query Store in SQL Server 2016Troubleshooting Plan Changes with Query Store in SQL Server 2016
Troubleshooting Plan Changes with Query Store in SQL Server 2016
 
Great Scott! Dealing with New Datatypes
Great Scott! Dealing with New DatatypesGreat Scott! Dealing with New Datatypes
Great Scott! Dealing with New Datatypes
 
Agile, Automated, Aware: How to Model for Success
Agile, Automated, Aware: How to Model for SuccessAgile, Automated, Aware: How to Model for Success
Agile, Automated, Aware: How to Model for Success
 
What's New in DBArtisan and Rapid SQL 2016
What's New in DBArtisan and Rapid SQL 2016What's New in DBArtisan and Rapid SQL 2016
What's New in DBArtisan and Rapid SQL 2016
 

Kürzlich hochgeladen

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 

Kürzlich hochgeladen (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

Python for Delphi Developers - Part 2

  • 1. Python for Delphi Developers (Part II) Webinar by Kiriakos Vlahos (aka PyScripter) and Jim McKeeth (Embarcadero)
  • 2. Contents •VarPyth Using python libraries and objects in Delphi code •Core libraries •Visualization •Machine Learning Python based data analytics in Delphi applications •TPythonThread Running python scripts without blocking your GUI Creating Python extension modules using Delphi •WrapDelphi and WrapDelphiVCL units Python GUI development using the VCL
  • 3. VarPyth • High-level access to python objects from Delphi code • It also allows you to create common python objects (lists, tuples etc.) • Uses custom variants • No need to use the low-level python API or deal with python object reference counting • Small performance penalty • Example • ShowMessage(SysModule.version) • Explore Demo25 and the VarPyth unit tests
  • 4. VarPyth Demoprocedure TForm1.FormCreate(Sender: TObject); begin var np := Import('numpy'); var np_array: Variant := np.array(VarPythonCreate([1,2,3,4,5,6,7,8,9,10])); PythonModule.SetVar('np_array’, ExtractPythonObjectFrom(np_array)); end; Python code: from delphi_module import np_array print("type(np_array) = ", type(np_array)) print("len(np_array) = ", len(np_array)) print("np_array = ", np_array) res_array = np_array.copy() for i in range(len(np_array)): res_array[i] *= np_array[i] print("res_array = ", res_array) Output: type(np_array) = <class 'numpy.ndarray'> len(np_array) = 10 np_array = [ 1 2 3 4 5 6 7 8 9 10] res_array = [ 1 4 9 16 25 36 49 64 81 100] procedure TForm1.btnRunClick(Sender: TObject); begin GetPythonEngine.ExecString(UTF8Encode(sePythonCode.Text)); for var V in VarPyIterate(MainModule.res_array) do ListBox.Items.Add(V); end; To learn more, explore Demo25 and the VarPyth unit tests
  • 5. Core Python Libraries • Core libraries • numpy – arrays and matrix algebra • scipy – math, science and engineering • pandas – data structure and analysis, R-like dataframes • Data visualization • matplotlib – matlab-like plotting • seaborn – statistical data visualization • mpld3 – turn matplotlib plots into interactive web pages • bokeh - interactive visualization library for modern browsers • plotly – interactive browser-based graphing library • altair – based on the visualization grammar vega-light
  • 6. Data visualization Demos - pyVIZsvg • Create charts with python libraries, save them in svg format and plot them in Delphi • Uses matplotlib and seaborn python libraries • Uses TSVGIconImage from EtheaDev SVGIconImageList components
  • 7. Interactive Data Visualization Demo - PychartHtml • Create interactive charts in python save them to html and show them inside Delphi applications • Showcases the new TEdgeBrowser • Uses the matplotlib with mpld3, altair and bohek python libraries
  • 8. Machine Learning Python Libraries • tensorflow (Google) • keras – high level pythonic interface • PyTorch (Facebook) • CNTK - The Microsoft Cognitive Toolkit (Microsoft) • Spark MLlib and mxnet (Apache Foundation) • scikit-learn • pure-python, general library, wide coverage, good choice for newcomers to ML/AI
  • 9. Data Analytics Demo: COVID-19 • Demonstrates the combined use of numpy, pandas, matplotlib and scikit-learn • Use pandas to download Covid-19 confirmed cases data from Web and aggregate it • Use scikit-learn to • Split the data into training and test sets • Transform the data • Define model (Bayesian Ridge Regression) • Optimize model parameters • Generate predictions • Use matplotlib to compare actual vrs fitted test data.
  • 10. Running Python Scripts Without Blocking Your Main Thread • Python uses the infamous Global Interpreter Lock (GIL) • This means that only one thread can run python code at any given time • Python switches between python created threads automatically • Applications using python need to acquire the GIL before running python code and release it soon afterwards • Welcome to TPythonThread • TThread descendent • Automatically acquires and releases the GIL
  • 11. Python threads – demo33 • Shows you how to • use TPythonThread • use new sub-interpreters • synchronize with the main thread • interrupt running threads with a keyboard interrupt exception
  • 12. Technical Aside I • FPU Exception mask • Delphi’s default FPU exception mask is different from most other Windows apps • Incompatible with python libraries written in C or C++ • If you use numpy, scipy, tensorflow etc. you need to match the FPU mask they expect to operate with • PythonEngine.pas provides a function for doing that: MaskFPUExceptions • Call MaskFPUExceptions(True) before python is loaded • e.g. the initialization section of your main form • See the P4D Wiki page for details
  • 13. Technical Aside II • Working with different python distributions: • P4D makes a good effort to discover registered python distributions automatically • But sometimes you want to use python distributions which are not registered • One such case is when want to deploy your application bundled with python. Python.org offers such a minimal distribution for applications embedding python. • Additional considerations apply when using an Anaconda distribution • Read the Finding Python P4D Wiki page carefully
  • 14. P4D Python Extension Modules • Python extension modules are dynamic link libraries that can be used by python in a way similar to modules developed in python. • They have ‘pyd’ extension. • P4D makes it very easy to create extension modules that contain functions and types developed in Delphi. • These extension modules can be used by Python, independently of Delphi, and can be packaged with setuptools and distributed through PyPi.
  • 15. Python extension modules Demo function PyInit_DemoModule: PPyObject; //function exported by dll – initializes the module begin try gEngine := TPythonEngine.Create(nil); gEngine.AutoFinalize := False; gEngine.UseLastKnownVersion := False; // Adapt to the desired python version gEngine.RegVersion := '3.8'; gEngine.DllName := 'python38.dll'; gModule := TPythonModule.Create(nil); gModule.Engine := gEngine; gModule.ModuleName := 'DemoModule'; gModule.AddMethod('is_prime', delphi_is_prime, 'is_prime(n) -> bool' ); gEngine.LoadDll; except end; Result := gModule.Module; end; Python test module: test.py from DemoModule import is_prime from timeit import Timer def count_primes(max_n): res = 0 for i in range(2, max_n + 1): if is_prime(i): res += 1 return res Command line: > C:PythonPython38python test.py Number of primes between 0 and 1000000 = 78498 Elapsed time: 0.29756570000000004 secs
  • 16. Wrapping VCL as a Python Extension Module I • We can use the same approach to create an extension module wrapping VCL • Uses the WrapDelphi and WrapDelphiVCL units • The whole of VCL (almost) is wrapped in 40 lines of code • The generated Delphi.pyd file is only 5Mbs • It can be uses to create VCL-based GUIs in python without needing Delphi • A similar approach could be used to wrap FMX and create a multi-platform python GUI library • Unclear whether there are licensing restrictions in distributing such a file
  • 17. Wrapping VCL as a Python Extension Module II unit uMain; interface uses PythonEngine; function PyInit_Delphi: PPyObject; cdecl; implementation uses WrapDelphi, WrapDelphiVCL; // similar to the previous extension module TestApp.py from Delphi import * class MainForm(Form): def __init__(self, Owner): self.Caption = "A Delphi Form..." self.SetBounds(10, 10, 500, 400) self.lblHello = Label(self) self.lblHello.SetProps(Parent=self, Caption="Hello World") self.lblHello.SetBounds(10, 10, 300, 24) self.OnClose = self.MainFormClose def MainFormClose(self, Sender, Action): Action.Value = caFree def main(): Application.Initialize() Application.Title = "MyDelphiApp" f = MainForm(Application) f.Show() FreeConsole() Application.Run() main() Command line: > C:PythonPython38python .TestApp.py
  • 18. Summary • With Python for Delphi you can get the best of both worlds • P4D makes it very easy to integrate Python into Delphi applications in RAD way, thus providing access to a vast range of python libraries • Expose Delphi function, objects, records and types to Python using low or high-level interfaces (WrapDelphi) • Create/Access/Use Python objects/modules in your Delphi code using a high- level interface (VarPyth) • Run python code in threads • Create python extensions modules • Wrap Vcl as a Python extension module to create GUIs with python github.com/pyscripter/python4delphi/tree/master/Tutorials/Webinar%20II