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

Integrate Python Threading, Windows Console, And Command Line Arguments In Delphi Windows GUI Apps

We know how to do Multithreading in Delphi. How about a simple python script that performs threading in Python and runs the script in the Delphi application? This brings the advantage of using existing multithreaded or new python scripts in your Delphi application. This post guide you to do that with the Python4Delphi Sample app. You can also use Python4Delphi with C++Builder.

Python4Delphi Demo22 Sample App shows how to create a Python script in Delphi Application which demonstrates creating thread and output the result in windows console, passing arguments in the command line. You can find the Demo22 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 Demo22 App:

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

Implementation Details:

[crayon-67437071bff7c509200603/]

The script below is executed which will opens a window console, create threads put in a queue and execute one after other.

[crayon-67437071bff85639987472/]

Head over and check out the open source Python4Delphi project which makes it easy to build Python GUIs for Windows with Delphi.

Exit mobile version