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

Easily Wrap Any Delphi Object Into A Python Object In This Sample Windows App

Do you want to leverage your Delphi Objects in the Python Scripts with less code? Python4Delphi has the flexibility to do that using a TPyDelphiWrapper component. This benefits Delphi Developers easily to wrap the existing or new Delphi Objects into Python Objects. You can also use Python4Delphi with C++Builder to build Python GUI apps.

Python4Delphi Demo31 Sample App shows how to wrap a Delphi Object to Python Object and Unit test some of the Wrapped Delphi Objects using python script. You can find the Demo31 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 Demo31 App:

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

Implementation Details:

[crayon-6767d2d0226c5751372098/]

In this sample App, Along with the Delphi Application’s MainForm, TTestClass, TTestRTTIAccess objects were wrapped to python Object and included in a PythonModule with different variables names. Later these variables were imported into the python script and unit tested by the python script in Memo1. Form Creation from Python, Subclassing, Navigation, unit testing is also carried in the Python Script.

[crayon-6767d2d0226cb987370782/]
<strong>Python4Delphi Demo31<strong>
Exit mobile version