Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Learn To Use Python Objects Inside Your Delphi Source Code With This Windows Sample App

Sometimes we may need to use Python objects like COM automation objects, inside your Delphi source code. Thinking about how to do it? Don’t worry. Python4Delphi has an excellent library unit that does for us. Using this we just create python objects by passing values as a variant that will return the python type as Delphi variant type. Also, the library has extensive helper routines to validate the type as well. This post guide you to understand better using the Python4Delphi sample app. You can also use Python4Delphi with C++Builder.

Python4Delphi Demo25 Sample App shows how to create a python variable type (i.e. Integer, Float, String, Dates, Mappings, Object types) in Delphi by just passing values as variant type parameters. You can find the Demo25 source on GitHub.

Prerequisites: Download and install the latest Python for your platform. Follow the Python4Delphi installation instructions mentioned here. Alternatively, you can check out this video Getting started with Python4Delphi.

Components used in Python4Delphi Demo25 App:

You can find the Python4Delphi Demo25 sample project from the extracted GitHub repository ..Python4DelphiDemosDemo25.dproj. Open this project in RAD Studio 10.4.1 and run the application.

Implementation Details:

[crayon-672a45444275b088184680/]

Note : The demo sample demonstrates more functionalities within each Button clicks for different python types compared to above snippet.

<strong>Python4Delphi Demo25<strong>
Exit mobile version