API Reference for Enthought Tool Suite 3.0.1
Windows GUI automation utilities.
Until I get around to writing some docs and examples, the tests at the foot of this module should serve to get you started.
Activate a menu item.
WinGuiAutoError when the requested menu option isn't found.
Usage example:
activateMenuItem(notepadWindow, ('file', 'open'))
Which is exactly equivalent to:
activateMenuItem(notepadWindow, (0, 1))
Simulates a single mouse click on a button
Usage example:
okButton = findControl(fontDialog,
wantedClass="Button",
wantedText="OK")
clickButton(okButton)
Simulates a single mouse click on a static
Usage example: TODO
Simulates a double mouse click on a static
Usage example: TODO
Dump all controls from a window into a nested list
Useful during development, allowing to you discover the structure of the contents of a window, showing the text and class of all contained controls.
A nested list of controls. Each entry consists of the control's hwnd, its text, its class, and its sub-controls, if any.
Usage example:
replaceDialog = findTopWindow(wantedText='Replace') pprint.pprint(dumpWindow(replaceDialog))
Find a control.
You can identify a control using caption, classe, a custom selection function, or any combination of these. (Multiple selection criteria are ANDed. If this isn't what's wanted, use a selection function.)
The window handle of the first control matching the supplied selection criteria.
WinGuiAutoError, when no control found.
Usage example:
optDialog = findTopWindow(wantedText="Options")
okButton = findControl(optDialog,
wantedClass="Button",
wantedText="OK")
Find controls.
You can identify controls using captions, classes, a custom selection function, or any combination of these. (Multiple selection criteria are ANDed. If this isn't what's wanted, use a selection function.)
The window handles of the controls matching the supplied selection criteria.
Usage example:
optDialog = findTopWindow(wantedText="Options")
def findButtons(hwnd, windowText, windowClass):
return windowClass == "Button"
buttons = findControl(optDialog, wantedText="Button")
Find the hwnd of a top level window. You can identify windows using captions, classes, a custom selection function, or any combination of these. (Multiple selection criteria are ANDed. If this isn't what's wanted, use a selection function.)
Usage example:
optDialog = findTopWindow(wantedText="Options")
Find the hwnd of top level windows.
You can identify windows using captions, classes, a custom selection function, or any combination of these. (Multiple selection criteria are ANDed. If this isn't what's wanted, use a selection function.)
A list containing the window handles of all top level windows matching the supplied selection criteria.
Usage example:
optDialogs = findTopWindows(wantedText="Options")
Returns the items in a combo box control.
Combo box items.
Usage example:
fontCombo = findControl(fontDialog, wantedClass="ComboBox") fontComboItems = getComboboxItems(fontCombo)
Returns the text in an edit control.
Edit control text lines.
Usage example:
pprint.pprint(getEditText(editArea))
Returns the items in a list box control.
List box items.
Usage example: TODO
Get various info about a menu item.
Menu item information object. This object is basically a 'bunch' (see http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308). It will have useful attributes: name, itemCount, submenu, isChecked, isDisabled, isGreyed, and isSeperator
WinGuiAutoError when the requested menu option isn't found.
Usage example:
submenuInfo = getMenuInfo(hMenu, submenu) hMenu, hMenuItemCount = submenuInfo.submenu, submenuInfo.itemCount
Get a window's main, top level menu.
The menu handle of the window's main, top level menu.
Usage example:
hMenu = getTopMenu(hWnd)
Selects a specified item in a Combo box control.
Usage example:
fontComboItems = getComboboxItems(fontCombo)
selectComboboxItem(fontCombo,
random.choice(fontComboItems))
Selects a specified item in a list box control.
Usage example: TODO
Set an edit control's text.
Usage example:
print "Enter various bits of text." setEditText(editArea, "Hello, again!") time.sleep(.5) setEditText(editArea, "You still there?") time.sleep(.5) setEditText(editArea, ["Here come", "two lines!"]) time.sleep(.5) print "Add some..." setEditText(editArea, ["", "And a 3rd one!"], append=True) time.sleep(.5)
| Local name | Refers to |
|---|---|
| array | array |
| ctypes | ctypes |
| os | os |
| struct | struct |
| sys | sys |
| win32api | win32api |
| win32con | win32con |
| win32gui | win32gui |
© Copyright 2002-2008 Enthought, Inc.