企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# pywinauto.controls.win32_controls 包装各种标准窗口控件 [TOC] ## *class* `pywinauto.controls.win32_controls.ButtonWrapper`(*hwnd*) Bases: `pywinauto.controls.hwndwrapper.HwndWrapper` 包裹一个Windows按钮控件 ### `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`](pywinauto.controls.hwndwrapper.html#pywinauto.controls.hwndwrapper.HwndWrapper "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*[¶](#pywinauto.controls.win32_controls.EditWrapper.has_title "Permalink to this definition") > > `line_count`()[¶](#pywinauto.controls.win32_controls.EditWrapper.line_count "Permalink to this definition") > > Return how many lines there are in the Edit > > `line_length`(*line\_index*)[¶](#pywinauto.controls.win32_controls.EditWrapper.line_length "Permalink to this definition") > > Return how many characters there are in the line > > `select`(*start=0*, *end=None*)[¶](#pywinauto.controls.win32_controls.EditWrapper.select "Permalink to this definition") > > Set the edit selection of the edit control > > `selection_indices`()[¶](#pywinauto.controls.win32_controls.EditWrapper.selection_indices "Permalink to this definition") > > The start and end indices of the current selection > > `set_edit_text`(*text*, *pos\_start=None*, *pos\_end=None*)[¶](#pywinauto.controls.win32_controls.EditWrapper.set_edit_text "Permalink to this definition") > > Set the text of the edit control > > `set_text`(*text*, *pos\_start=None*, *pos\_end=None*)[¶](#pywinauto.controls.win32_controls.EditWrapper.set_text "Permalink to this definition") > > Set the text of the edit control > > `set_window_text`(*text*, *append=False*)[¶](#pywinauto.controls.win32_controls.EditWrapper.set_window_text "Permalink to this definition") > > 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`()[¶](#pywinauto.controls.win32_controls.EditWrapper.text_block "Permalink to this definition") > > Get the text of the edit control > > `texts`()[¶](#pywinauto.controls.win32_controls.EditWrapper.texts "Permalink to this definition") > > Get the text of the edit control > > `windowclasses` *= \['Edit', '.\*Edit', 'TMemo', 'WindowsForms\\\\d\*\\\\.EDIT\\\\..\*', 'ThunderTextBox', 'ThunderRT6TextBox'\]*[¶](#pywinauto.controls.win32_controls.EditWrapper.windowclasses "Permalink to this definition") > > `writable_props`[¶](#pywinauto.controls.win32_controls.EditWrapper.writable_props "Permalink to this definition") > > Extend default properties list. > ## *class* `pywinauto.controls.win32_controls.``ListBoxWrapper`(*hwnd*) Bases: [`pywinauto.controls.hwndwrapper.HwndWrapper`](pywinauto.controls.hwndwrapper.html#pywinauto.controls.hwndwrapper.HwndWrapper "pywinauto.controls.hwndwrapper.HwndWrapper") Wrap a windows ListBox control ### `GetItemFocus`(*\*args*, *\*\*kwargs*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.GetItemFocus "Permalink to this definition") > > `IsSingleSelection`(*\*args*, *\*\*kwargs*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.IsSingleSelection "Permalink to this definition") > > `ItemCount`(*\*args*, *\*\*kwargs*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.ItemCount "Permalink to this definition") > > `ItemData`(*\*args*, *\*\*kwargs*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.ItemData "Permalink to this definition") > > `ItemRect`(*\*args*, *\*\*kwargs*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.ItemRect "Permalink to this definition") > > `ItemTexts`(*\*args*, *\*\*kwargs*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.ItemTexts "Permalink to this definition") > > `Select`(*\*args*, *\*\*kwargs*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.Select "Permalink to this definition") > > `SelectedIndices`(*\*args*, *\*\*kwargs*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.SelectedIndices "Permalink to this definition") > > `SetItemFocus`(*\*args*, *\*\*kwargs*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.SetItemFocus "Permalink to this definition") > > `friendlyclassname` *= 'ListBox'*[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.friendlyclassname "Permalink to this definition") > > `get_item_focus`()[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.get_item_focus "Permalink to this definition") > > Retrun the index of current selection in a ListBox > > `has_title` *= False*[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.has_title "Permalink to this definition") > > `is_single_selection`()[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.is_single_selection "Permalink to this definition") > > Check whether the listbox has single selection mode. > > `item_count`()[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.item_count "Permalink to this definition") > > Return the number of items in the ListBox > > `item_data`(*i*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.item_data "Permalink to this definition") > > Return the item\_data if any associted with the item > > `item_rect`(*item*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.item_rect "Permalink to this definition") > > Return the rect of the item > > `item_texts`()[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.item_texts "Permalink to this definition") > > Return the text of the items of the listbox > > `select`(*item*, *select=True*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.select "Permalink to this definition") > > 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`()[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.selected_indices "Permalink to this definition") > > The currently selected indices of the listbox > > `set_item_focus`(*item*)[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.set_item_focus "Permalink to this definition") > > Set the ListBox focus to the item at index > > `texts`()[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.texts "Permalink to this definition") > > Return the texts of the control > > `windowclasses` *= \['ListBox', 'WindowsForms\\\\d\*\\\\.LISTBOX\\\\..\*', '.\*ListBox'\]*[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.windowclasses "Permalink to this definition") > > `writable_props`[¶](#pywinauto.controls.win32_controls.ListBoxWrapper.writable_props "Permalink to this definition") > > Extend default properties list. > > *class* `pywinauto.controls.win32_controls.``PopupMenuWrapper`(*element\_info*)[¶](#pywinauto.controls.win32_controls.PopupMenuWrapper "Permalink to this definition") > > Bases: [`pywinauto.controls.hwndwrapper.HwndWrapper`](pywinauto.controls.hwndwrapper.html#pywinauto.controls.hwndwrapper.HwndWrapper "pywinauto.controls.hwndwrapper.HwndWrapper") > > Wrap a Popup Menu > > `friendlyclassname` *= 'PopupMenu'*[¶](#pywinauto.controls.win32_controls.PopupMenuWrapper.friendlyclassname "Permalink to this definition") > > `has_title` *= False*[¶](#pywinauto.controls.win32_controls.PopupMenuWrapper.has_title "Permalink to this definition") > > `is_dialog`()[¶](#pywinauto.controls.win32_controls.PopupMenuWrapper.is_dialog "Permalink to this definition") > > Return whether it is a dialog > > `windowclasses` *= \['#32768'\]*[¶](#pywinauto.controls.win32_controls.PopupMenuWrapper.windowclasses "Permalink to this definition") > > *class* `pywinauto.controls.win32_controls.``StaticWrapper`(*hwnd*)[¶](#pywinauto.controls.win32_controls.StaticWrapper "Permalink to this definition") > > Bases: [`pywinauto.controls.hwndwrapper.HwndWrapper`](pywinauto.controls.hwndwrapper.html#pywinauto.controls.hwndwrapper.HwndWrapper "pywinauto.controls.hwndwrapper.HwndWrapper") > > Wrap a windows Static control > > `can_be_label` *= True*[¶](#pywinauto.controls.win32_controls.StaticWrapper.can_be_label "Permalink to this definition") > > `friendlyclassname` *= 'Static'*[¶](#pywinauto.controls.win32_controls.StaticWrapper.friendlyclassname "Permalink to this definition") > > `windowclasses` *= \['Static', 'WindowsForms\\\\d\*\\\\.STATIC\\\\..\*', 'TPanel', '.\*StaticText'\]*[¶](#pywinauto.controls.win32_controls.StaticWrapper.windowclasses "Permalink to this definition")