Skip to content

Window

flaui.core.automation_elements.Window

Bases: AutomationElement

Class to interact with a window element.

context_menu property

Gets the context menu for the window. /// Note: It uses the FrameworkType of the window as lookup logic. Use GetContextMenuByFrameworkType" /> if you want to control this.

Returns:

Type Description
Menu

Context menu item

is_main_window property writable

Flag to indicate, if the window is the application's main window. Is used so that it does not need to be looked up again in some cases (e.g. Context Menu).

Returns:

Type Description
bool

True if the window is main window else False

is_modal property

Gets if the window is modal.

Returns:

Type Description
bool

True if window is modal, else False

popup property

Gets the current WPF popup window.

Returns:

Type Description
Window

Pop up window

title property

Gets the title of the window.

Returns:

Type Description
str

Title value

title_bar property

Gets the TitleBar of the window.

Returns:

Type Description
TitleBar

Title bar element

close()

Closes the window.

Source code in flaui/core/automation_elements.py
@handle_csharp_exceptions
def close(self):
    """Closes the window."""
    self.raw_element.Close()

get_context_menu_by_framework_type(framework_type)

Gets the context menu by a given FrameworkType.

Parameters:

Name Type Description Default
framework_type FrameworkType

Framework Type

required

Returns:

Type Description
Menu

Menu item

Source code in flaui/core/automation_elements.py
@handle_csharp_exceptions
def get_context_menu_by_framework_type(self, framework_type: FrameworkType) -> Menu:
    """Gets the context menu by a given FrameworkType.

    :param framework_type: Framework Type
    :return: Menu item
    """
    return Menu(raw_element=self.raw_element.GetContextMenuByFrameworkType(framework_type))

modal_windows()

Gets a list of all modal child windows.

Returns:

Type Description
List[Window]

List of window elements

Source code in flaui/core/automation_elements.py
@handle_csharp_exceptions
def modal_windows(self) -> List[Window]:
    """Gets a list of all modal child windows.

    :return: List of window elements
    """
    return [Window(raw_element=_) for _ in self.raw_element.ModalWindows()]

move(x, y)

Moves the window to the given coordinates.

Parameters:

Name Type Description Default
x int

X cordinate

required
y int

Y cordinate

required
Source code in flaui/core/automation_elements.py
@handle_csharp_exceptions
def move(self, x: int, y: int):
    """Moves the window to the given coordinates.

    :param x: X cordinate
    :param y: Y cordinate
    """
    self.raw_element.Move(x, y)

set_transparency(alpha)

Brings the element to the foreground.

Parameters:

Name Type Description Default
alpha bytes

Transparency value

required
Source code in flaui/core/automation_elements.py
@handle_csharp_exceptions
def set_transparency(self, alpha: bytes):
    """Brings the element to the foreground.

    :param alpha: Transparency value
    """
    self.raw_element.SetTransparency(alpha)