DelphiDelphiVCLPythonPython GUIWindows

Python Windows App: Draw A Rectangle With delphivcl.Shape

focused black businesswoman using laptop

Description

delphivcl.Shape represents a geometric shape that can be drawn on a form.

Add a Shape object to a form to draw a simple geometric shape on the form. TShape introduces properties to describe the pen used to outline the shape and the brush used to fill it.

If the shape is only part of the image of custom control, use the methods of the control’s canvas instead.

Browse all the properties, methods, and built-in properties of the delphivcl.Shape using dir() command:

See the responses in our Windows command prompt:

output01 4

Code example

Here is the working example of the implementation of delphivcl.Shape to draw a rectangle:

To see the result, let’s run the complete script:

The result:

1 2 3407976

Note for beta release users

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

  • Release version:
  • Beta version:

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

Also, watch the following webinar by Ian Barker on How to create a real Windows app step-by-step guide:


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.


References & further readings

[1] Embarcadero DocWiki. (2011). 

Vcl.ExtCtrls.TShape. Embarcadero DocWiki. Embarcadero Technologies. docwiki.embarcadero.com/Libraries/Sydney/en/ Vcl.ExtCtrls.TShape

Related posts
CodeIDELearn PythonPythonPython GUITkinter

How To Make More Than 20 ChatGPT Prompts Work With Python GUI Builders And OpenCV Library?

CodeIDEProjectsPythonWindows

Unlock the Power of Python for Deep Learning with Radial Basis Function Networks (RBFNs)

CodeIDELearn PythonPythonPython GUITkinter

How To Make More Than 20 ChatGPT Prompts Work With Python GUI Builders And NumPy Library?

CodeIDEProjectsPythonWindows

Unlock the Power of Python for Deep Learning with Generative Adversarial Networks (GANs) - The Engine behind DALL-E

Leave a Reply

Your email address will not be published. Required fields are marked *