Definitions
Python ports of the C# FlaUI.Core.Definitions enums (ControlType, ToggleState, TreeScope,
OrientationType, HeadingLevel, LiveSetting, ...). Member names and values mirror C# one to one:
None members are spelled None_ because None is a Python keyword.
Values FlaUI hands back are converted at the boundary, so you can assert against the Python enums:
- enum-typed element properties (
Properties.orientation,heading_level,landmark_type,live_setting,visual_effects) and pattern properties (AnnotationPattern.annotation_type,StylesPattern.style) return Python enums fromAutomationProperty.value/value_or_default; AutomationBase.coalesce_events/connection_recovery_behaviorread and acceptCoalesceEventsOptions/ConnectionRecoveryBehaviorOptions;- structure-changed, notification and text-edit event callbacks receive
StructureChangeType,NotificationKind/NotificationProcessingandTextEditChangeType.
VisualEffects is a [Flags] enum in C#, so it is an IntFlag in Python and combined effects
round-trip. FrameworkIds.convert maps between a FrameworkType and the UIA FrameworkId string.
flaui.core.definitions
This module contains wrapper classes for the C# namespace FlaUI.Core.Definitions. It defines several enums for different types of controls in Microsoft UI Automation.
AnnotationType
Bases: Enum
Contains the annotation types FlaUI exposes through the Annotation pattern.
The member values are FlaUI's own enum values. UIA's raw annotation type ids (60000 and up, as
returned by Properties.annotation_types) are a different number space and are not converted.
AutomationElementMode
Bases: Enum
Contains values that specify the type of reference to use when returning UI Automation elements.
CoalesceEventsOptions
Bases: Enum
Contains values that specify whether the automation coalesces events (AutomationBase.coalesce_events).
ConnectionRecoveryBehaviorOptions
Bases: Enum
Contains values that specify whether the automation recovers lost connections automatically.
ControlType
Bases: Enum
Types of controls in Microsoft UI Automation.
DockPosition
Bases: Enum
Contains values that specify the dock position of an element within a docking container.
ExpandCollapseState
Bases: Enum
Contains values that specify the expand/collapse state of a Microsoft UI Automation element that implements the ExpandCollapsePattern.
FrameworkIds
Python port of the C# static helper FlaUI.Core.Definitions.FrameworkIds.
It maps between a :class:~flaui.core.framework_types.FrameworkType and the UIA FrameworkId string
("WPF", "WinForm", "Win32", "XAML", "Qt"), delegating to FlaUI for exact parity.
convert(value)
staticmethod
Convert a framework id string to a FrameworkType, or a FrameworkType to its id string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
A UIA framework id string, or a Python or C# |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The matching Python |
Source code in flaui/core/definitions.py
HeadingLevel
Bases: Enum
Contains values that describe the heading level of an element (Properties.heading_level).
LandmarkType
Bases: Enum
Contains values that describe the landmark type of an element (Properties.landmark_type).
LiveSetting
Bases: Enum
Contains values that describe how a live region announces changes (Properties.live_setting).
NotificationKind
Bases: Enum
Contains values that describe the kind of a notification event.
NotificationProcessing
Bases: Enum
Contains values that describe how a notification event should be processed.
OrientationType
Bases: Enum
Contains values that specify the orientation of a control (Properties.orientation).
PropertyConditionFlags
Bases: Enum
Optional flags that are used when checking the property.
RowOrColumnMajor
Bases: Enum
Contains values that specify the row/column major order of items in a container.
ScrollAmount
Bases: Enum
Contains values that specify the direction and distance to scroll.
StructureChangeType
Bases: Enum
Contains values that describe the change passed to a structure-changed event handler.
StyleType
Bases: Enum
Contains values that describe the visual style of an element (StylesPattern.style).
SupportedTextSelection
Bases: Enum
Contains values that specify the supported text selection attribute of a text control.
SynchronizedInputType
Bases: Enum
Contains values that specify the type of synchronized input to listen for.
TextEditChangeType
Bases: Enum
Contains values that describe the change passed to a text-edit text-changed event handler.
TextPatternRangeEndpoint
Bases: Enum
Contains values that specify the endpoints of a text range.
TextUnit
Bases: Enum
Contains values that specify units of text for the purposes of navigation.
ToggleState
Bases: Enum
Contains values that specify the toggle state of a Microsoft UI Automation element that implements the TogglePattern
TreeScope
Bases: Enum
Contains values that specify the scope of various operations in the Microsoft UI Automation tree.
TreeTraversalOptions
Bases: Enum
Contains values that specify the traversal options for the tree walker.
VisualEffects
Bases: IntFlag
Contains the visual effects applied to an element (Properties.visual_effects).
The C# enum is a [Flags] enum, so this is an :class:~enum.IntFlag whose values are the C# integer
values: combined effects such as VisualEffects.Shadow | VisualEffects.Glow round-trip correctly.
WindowInteractionState
Bases: Enum
Contains values that specify the current state of a window for user interaction.
WindowVisualState
Bases: Enum
Contains values that specify the visual state of a window.
ZoomUnit
Bases: Enum
Contains values that specify the amount to zoom on a control.
to_cs_enum(value)
Convert a Python enum member to the C# value FlaUI expects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Union[Enum, Any]
|
A Python enum member from this module, or a raw C# value (passed through). |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The C# enum value. |
Source code in flaui/core/definitions.py
to_python_enum(value, enum_type=None)
Convert a C# FlaUI.Core.Definitions enum value to its Python enum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Any
|
The value returned by C#. Python enum members and values of unmapped types pass through. |
required |
enum_type
|
Optional[Type[Enum]]
|
The Python enum to convert to; inferred from the C# type of |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The matching Python enum member, or |