Site icon Python GUI

An Introduction To DelphiVCL: A Python GUI Builder For Windows

photo of man smiling in front of his laptop

Photo by Vanessa Garcia on Pexels.com

Sometimes your application needs a user interface with professional looks, but what is the best way to make one for Python applications? Try DelphiVCL for Python! 

DelphiVCL is a Python module giving Python GUI apps on Windows access to Delphi’s VCL for robust and high-performance native Windows visual widgets. It uses the Python4Delphi library as a bridge between Delphi’s VCL (Visual Component Library) and Python. DelphiVCL is currently available for Windows. 

The DelphiVCL Python module makes ‘the whole VCL’ available in Python! No Delphi or Object Pascal experience or knowledge is necessary for you as a Python developer to take full advantage of the Native GUI benefits.

 

How can we use DelphiVCL?

These are the steps for using the DelphiVCL:

1. Installing DelphiVCL

“Important update on Jan 14, 2022: DelphiVCL release version is finally out on PyPI!” 

Watch this comprehensive introduction to Python GUI Development with DelphiVCL library video by Jim McKeeth, for more information:

You can easily install DelphiVCL using pip in your Command Prompt:

[crayon-66067bc04223e596936591/]

And visit our GitHub for a quick start guide.

2. Installing DelphiVCL beta release (archive)

There are two ways for you to install DelphiVCL beta release: By directly copying the module to your local/system path, or install it via pip.

2.1. Copy to your local or system path

[crayon-66067bc042247510577946/]

Or

[crayon-66067bc042248899112899/]

if you use Anaconda Distributions.

2.2. Install via pip

[crayon-66067bc04224a457985717/]

The installation progress in your Command Prompt:

 

3. Run a simple form example

In essence, DelphiVCL is a wrapper that helps to create and access Delphi Objects quickly from Python. These wrappers contain container classes to extend and expose your custom events, methods, variables that can be used in Python script.

Here is a Python code sample using DelphiVCL to create a simple Form app with a list, edit, and button:

[crayon-66067bc04224d695113680/]

Here is the GUI created by the Python code above. You can run it using your favorite Python IDE, which for me is PyScripter:

Or you can save the script first, and run it through the command line using this command:

[crayon-66067bc04224e983679728/]

This GUI expects user inputs. Clicking the button will add the text from the edit box to the list box:

4. Note for beta release users

In practice, the only difference between DelphiVCL for Python release version and the beta version is only in how you write the DelphiVCL. Here is the example for how you import the library:

[crayon-66067bc042250971059808/]
[crayon-66067bc042251571620392/]

Conclusion

Congratulations, you already learn the powerful example of accessing Delphi’s VCL functionalities and features from Python, using DelphiVCL Modules.

Now it’s time for you to try it yourself, and please share your experiences in the comment section below.


Check out DelphiVCL which easily allows you to build GUIs for Windows using Python.

Check out Python4Delphi which easily allows you to build Python GUIs for Windows using Delphi.

Exit mobile version