Skip to content

Overlay

Visual-debugging overlays, ported from FlaUI.Core.Overlay. Each AutomationBase exposes an OverlayManager via overlay_manager; it draws a colored border around a screen rectangle for a short duration (the same mechanism used by AutomationElement.draw_highlight).

flaui.core.overlay.OverlayManager

Bases: BaseModel

Wraps a C# IOverlayManager (WinFormsOverlayManager or NullOverlayManager).

margin property writable

Get the overlay margin (use a negative value to move it inside the rectangle).

size property writable

Get the overlay border size.

dispose()

Dispose the overlay manager and release its resources.

Source code in flaui/core/overlay.py
@handle_csharp_exceptions
def dispose(self) -> None:
    """Dispose the overlay manager and release its resources."""
    self.raw_overlay_manager.Dispose()

show(rectangle, color, duration_in_ms)

Show the overlay for a duration asynchronously (non-blocking).

Parameters:

Name Type Description Default
rectangle Rectangle

The screen rectangle to outline.

required
color ColorData

The border color.

required
duration_in_ms int

How long to show the overlay, in milliseconds.

required
Source code in flaui/core/overlay.py
@handle_csharp_exceptions
def show(self, rectangle: Rectangle, color: ColorData, duration_in_ms: int) -> None:
    """Show the overlay for a duration asynchronously (non-blocking).

    :param rectangle: The screen rectangle to outline.
    :param color: The border color.
    :param duration_in_ms: How long to show the overlay, in milliseconds.
    """
    self.raw_overlay_manager.Show(rectangle.raw_value, color.cs_object, duration_in_ms)

show_blocking(rectangle, color, duration_in_ms)

Show the overlay and block execution until it is hidden again.

Parameters:

Name Type Description Default
rectangle Rectangle

The screen rectangle to outline.

required
color ColorData

The border color.

required
duration_in_ms int

How long to show the overlay, in milliseconds.

required
Source code in flaui/core/overlay.py
@handle_csharp_exceptions
def show_blocking(self, rectangle: Rectangle, color: ColorData, duration_in_ms: int) -> None:
    """Show the overlay and block execution until it is hidden again.

    :param rectangle: The screen rectangle to outline.
    :param color: The border color.
    :param duration_in_ms: How long to show the overlay, in milliseconds.
    """
    self.raw_overlay_manager.ShowBlocking(rectangle.raw_value, color.cs_object, duration_in_ms)