Telechargé par Zerguine Abderrahman

Python4CppBuilder

publicité
Using Python4Delphi with C++Builder
●
David I (Embarcadero MVP)
●
Kiriakos Vlahos (aka PyScripter)
●
Jim McKeeth (Embarcadero)
●
David Millington (Embarcadero)
1
Agenda
Using C++Builder with Python
●
Delphi4Python Overview
●
Delphi4Python components
●
Preparing C++Builder and Python4Delphi
●
C++ Demos
●
Summary
●
Additional Resources
●
Q&A
●
2
Using C++Builder with Python
Natural to use C/C++ and Python
●
Lots of Python re-usable packages
●
C++ component architecture, GUI, language
●
Both are among the top used languages
●
Ways to use C++Builder and Python
●
–
–
–
Use the Delphi4Python components
Create Python C/C++ modules
Boost Library for Python
3
Delphi4Python Overview
●
Access to the Python APIs
●
Bi-directional interaction with both languages
●
Access to Python objects
●
Wrap C++ objects for use from Python
●
Create Python extension modules
4
Delphi4Python components
PythonEngine: Load and Connect. Low-level API access.
●
PythonModule: Create C++ module to be used by Python
●
PythonType: Python class to be used by C++Builder
●
PythonInputOutput: send/receive to/from Python script
●
PythonGUIInputOutput: connect Python output to a TMemo
●
PyDelphiWrapper: classes/objects accessible from Python
●
unit VarPython: provides hi-level access to Python Objects
●
5
Preparing C++Builder and Python4Delphi
Install Python distro - python.org - Win32 and Win64
●
PIP install Python modules required by C++ projects
●
Clone/Download Delphi4Python GitHub repository
●
Set IDE Library and browse paths for Win32 and Win64
●
Build and Install the components for 10.4+ or 10.3●
–
–
Set the Project | Options | Building | Delphi Compiler | Output - C++ |
C/C++ Output file Generation: Generate all C++Builder files (including
package libs)
Use command line Delphi compilers or RAD Studio IDE to generate files
that C++Builder needs
6
C++ Demos
●
Demo01 (from the Delphi4Python distro)
Execute Python scripts
– Display the results
Demo19 (from the Delphi4Python distro)
–
●
–
–
Define a new Module
Call C++ method from Python
7
Summary
●
●
●
C++Builder has multiple ways to
integrate with Python
Delphi4Python is the fastest/easiest
way to connect C++Builder with Python
Enjoy the benefits of leveraging the
active Python open-source community
8
Additional Resources
●
●
●
●
●
●
●
Delphi and Python webinar 1 & 2 replays
– https://blogs.embarcadero.com/webinar-replay-python-for-delphi-developers-part-1-introduction/
– https://blogs.embarcadero.com/combining-the-strengths-of-delphi-and-python/
Using Python4Delphi with C++Builder VCL applications
– https://davidiontools.com/2020/10/13/using-python4delphi-with-cbuilder-vcl-applications/
Delphi4Python GitHub
– https://github.com/pyscripter/python4delphi
Getting Started with Python4Delphi
– https://blogs.embarcadero.com/getting-started-wit-python4delphi/
Support on DelphiPraxis
– https://en.delphipraxis.net/forum/39-python4delphi/
Introductory tutorial by Dr K. R. Bond
– https://github.com/pyscripter/python4delphi/wiki/Files/Chapter80Tutorial.pdf
– https://github.com/pyscripter/python4delphi/wiki/Files/Chapter80Sample.pdf
Webinar Tutorials
– https://github.com/pyscripter/python4delphi/tree/master/Tutorials/Webinar%20I
– https://github.com/pyscripter/python4delphi/tree/master/Tutorials/Webinar%20II
9
Q&A
●
David I: [email protected]
●
Kiriakos: [email protected]
●
Jim: [email protected]
●
David M: [email protected]
10
Téléchargement