Site icon Python GUI

How to use the State Property

man sitting cozy while working on his laptop

Photo by Canva Studio on Pexels.com

State property is used as an indicator for which items are selected or checked.

For example, for each member of the Items array, we use State to determine whether the checkbox is selected (cbChecked), cleared (cbUnchecked), or dimmed (cbGrayed). 

Note: cbGrayed corresponds to the indeterminate state.

State combines the information provided by the Boolean Checked property and the Boolean ItemEnabled property:

Another example of a State use case is in Draw Grid creation. State will show us the selected cell in the created grid or table. 

Here is the working example of the implementation of State in Draw Grid creation:

[crayon-662e87854c29f487180164/]

See the complete code here.

The result:

 

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

Exit mobile version