pyaccesskit.forms.controls¶
pyaccesskit.forms.controls ¶
Specifications of form controls.
Each control kind is its own spec class; together they form the discriminated union :data:ControlSpec
(kind is the discriminator). Positions and sizes are :class:~pyaccesskit.units.Length values and are
optional: the layout engine places controls that have no explicit at=.
ControlSpec
module-attribute
¶
ControlSpec = Annotated[
LabelSpec
| TextBoxSpec
| CheckBoxSpec
| ComboBoxSpec
| ButtonSpec,
Field(discriminator="kind"),
]
Any control spec (a Pydantic discriminated union on kind).
ControlBase ¶
Bases: SpecModel
Options shared by all controls.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Control name. Bound controls default to their field name. |
section |
Section
|
Form section holding the control. |
at |
tuple[Length, Length] | None
|
Explicit |
width |
Length | None
|
Explicit width (defaults depend on the control kind). |
height |
Length | None
|
Explicit height. |
visible |
bool
|
Whether the control is visible in Form view. |
properties |
dict[str, PropertyValue]
|
Other Access control properties to set verbatim (escape hatch). |
LabelSpec ¶
TextBoxSpec ¶
Bases: _BoundControl
A text box bound to field or showing a calculated control_source ("=[Qty]*[Price]").
CheckBoxSpec ¶
Bases: _BoundControl
A check box (typically bound to a Yes/No field).
ComboBoxSpec ¶
Bases: _BoundControl
A combo box whose rows come from a table/query/SQL statement or a value list.