pywinauto.controls.win32_controls

Wraps various standard windows controls

class pywinauto.controls.win32_controls.ButtonWrapper(hwnd)

Bases: pywinauto.controls.hwndwrapper.HwndWrapper

Wrap a windows Button control

Check(*args, **kwargs)
CheckByClick(*args, **kwargs)
CheckByClickInput(*args, **kwargs)
GetCheckState(*args, **kwargs)
SetCheckIndeterminate(*args, **kwargs)
UnCheck(*args, **kwargs)
UncheckByClick(*args, **kwargs)
UncheckByClickInput(*args, **kwargs)
can_be_label = True
check()

Check a checkbox

check_by_click()

Check the CheckBox control by click() method

check_by_click_input()

Check the CheckBox control by click_input() method

click(button='left', pressed='', coords=(0, 0), double=False, absolute=False)

Click the Button control

friendly_class_name()

Return the friendly class name of the button

Windows controls with the class “Button” can look like different controls based on their style. They can look like the following controls:

  • Buttons, this method returns “Button”
  • CheckBoxes, this method returns “CheckBox”
  • RadioButtons, this method returns “RadioButton”
  • GroupBoxes, this method returns “GroupBox”
friendlyclassname = 'Button'
get_check_state()

Return the check state of the checkbox

The check state is represented by an integer 0 - unchecked 1 - checked 2 - indeterminate

The following constants are defined in the win32defines module BST_UNCHECKED = 0 BST_CHECKED = 1 BST_INDETERMINATE = 2

is_checked()

Return True if checked, False if not checked, None if indeterminate

is_dialog()

Buttons are never dialogs so return False

set_check_indeterminate()

Set the checkbox to indeterminate

uncheck()

Uncheck a checkbox

uncheck_by_click()

Uncheck the CheckBox control by click() method

uncheck_by_click_input()

Uncheck the CheckBox control by click_input() method

windowclasses = ['Button', '.*Button', 'WindowsForms\\d*\\.BUTTON\\..*', '.*CheckBox']
class pywinauto.controls.win32_controls.ComboBoxWrapper(hwnd)

Bases: pywinauto.controls.hwndwrapper.HwndWrapper

Wrap a windows ComboBox control

DroppedRect(*args, **kwargs)
ItemCount(*args, **kwargs)
ItemData(*args, **kwargs)
ItemTexts(*args, **kwargs)
Select(*args, **kwargs)
SelectedIndex(*args, **kwargs)
SelectedText(*args, **kwargs)
dropped_rect()

Get the dropped rectangle of the combobox

friendlyclassname = 'ComboBox'
get_properties()

Return the properties of the control as a dictionary

has_title = False
item_count()

Return the number of items in the combobox

item_data(item)

Returns the item data associated with the item if any

item_texts()

Return the text of the items of the combobox

select(item)

Select the ComboBox item

item can be either a 0 based index of the item to select or it can be the string that you want to select

selected_index()

Return the selected index

selected_text()

Return the selected text

texts()

Return the text of the items in the combobox

windowclasses = ['ComboBox', 'WindowsForms\\d*\\.COMBOBOX\\..*', '.*ComboBox']
writable_props

Extend default properties list.

class pywinauto.controls.win32_controls.EditWrapper(hwnd)

Bases: pywinauto.controls.hwndwrapper.HwndWrapper

Wrap a windows Edit control

GetLine(*args, **kwargs)
LineCount(*args, **kwargs)
LineLength(*args, **kwargs)
Select(*args, **kwargs)
SelectionIndices(*args, **kwargs)
SetEditText(*args, **kwargs)
SetText(*args, **kwargs)
TextBlock(*args, **kwargs)
friendlyclassname = 'Edit'
get_line(line_index)

Return the line specified

has_title = False
line_count()

Return how many lines there are in the Edit

line_length(line_index)

Return how many characters there are in the line

select(start=0, end=None)

Set the edit selection of the edit control

selection_indices()

The start and end indices of the current selection

set_edit_text(text, pos_start=None, pos_end=None)

Set the text of the edit control

set_text(text, pos_start=None, pos_end=None)

Set the text of the edit control

set_window_text(text, append=False)

Override set_window_text for edit controls because it should not be used for Edit controls.

Edit Controls should either use set_edit_text() or type_keys() to modify the contents of the edit control.

text_block()

Get the text of the edit control

texts()

Get the text of the edit control

windowclasses = ['Edit', '.*Edit', 'TMemo', 'WindowsForms\\d*\\.EDIT\\..*', 'ThunderTextBox', 'ThunderRT6TextBox']
writable_props

Extend default properties list.

class pywinauto.controls.win32_controls.ListBoxWrapper(hwnd)

Bases: pywinauto.controls.hwndwrapper.HwndWrapper

Wrap a windows ListBox control

GetItemFocus(*args, **kwargs)
IsSingleSelection(*args, **kwargs)
ItemCount(*args, **kwargs)
ItemData(*args, **kwargs)
ItemRect(*args, **kwargs)
ItemTexts(*args, **kwargs)
Select(*args, **kwargs)
SelectedIndices(*args, **kwargs)
SetItemFocus(*args, **kwargs)
friendlyclassname = 'ListBox'
get_item_focus()

Retrun the index of current selection in a ListBox

has_title = False
is_single_selection()

Check whether the listbox has single selection mode.

item_count()

Return the number of items in the ListBox

item_data(i)

Return the item_data if any associted with the item

item_rect(item)

Return the rect of the item

item_texts()

Return the text of the items of the listbox

select(item, select=True)

Select the ListBox item

item can be either a 0 based index of the item to select or it can be the string that you want to select

selected_indices()

The currently selected indices of the listbox

set_item_focus(item)

Set the ListBox focus to the item at index

texts()

Return the texts of the control

windowclasses = ['ListBox', 'WindowsForms\\d*\\.LISTBOX\\..*', '.*ListBox']
writable_props

Extend default properties list.

class pywinauto.controls.win32_controls.PopupMenuWrapper(element_info)

Bases: pywinauto.controls.hwndwrapper.HwndWrapper

Wrap a Popup Menu

friendlyclassname = 'PopupMenu'
has_title = False
is_dialog()

Return whether it is a dialog

windowclasses = ['#32768']
class pywinauto.controls.win32_controls.StaticWrapper(hwnd)

Bases: pywinauto.controls.hwndwrapper.HwndWrapper

Wrap a windows Static control

can_be_label = True
friendlyclassname = 'Static'
windowclasses = ['Static', 'WindowsForms\\d*\\.STATIC\\..*', 'TPanel', '.*StaticText']