Site icon Python GUI

Learn About Using Delphi Python GUI Methods In Python On Windows

Earlier we have seen how to add methods in Python Module using Python4Delphi TPythonModule component’s Add Method. However, the Add Method parameter uses a PyCFunction type parameter. In many cases, we may need to define the method which should return Delphi Type. How to do that? This post will provide a way to do that using the TPythonModule component itself. You can also use Python4Delphi with C++Builder.

Python4Delphi Demo7 Sample App shows how to create a Module, add a Delphi Method to that module, Import the module in a python script, and access the added routine. You can find the Demo7 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 Demo5 App:

Note: This Demo also uses TPythonType component but this post doesn’t cover that. To learn about TPythonType check this post.

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

Implementation Details:

[crayon-66223d7801a6e419281845/]
[crayon-66223d7801a7d066653812/]
Python4Delphi Demo7

Check some of the tutorials available for Python4Delphi here

Exit mobile version