pyWinAuto: pywinauto.controls.menuwrapper.Menu -- A simple wrapper around a menu handle

Menu

A simple wrapper around a menu handle

A menu supports methods for querying the menu and getting it's menu items.


Methods

f __init__(self, owner_ctrl, menuhandle, is_main_menu=True, owner_item=None) ...

Initialize the class.

  • owner_ctrl is the Control that owns this menu
  • menuhandle is the menu handle of the menu
  • is_main_menu we have to track whether it is the main menu or a popup menu
  • owner_item The item that contains this menu - this will be None for the main menu, it will be a MenuItem instance for a submenu.

f ItemCount(self) ...

Return the count of items in this menu

f Item(self, index) ...

Return a specific menu item

  • index is the 0 based index of the menu item you want

f Items(self) ...

Return a list of all the items in this menu

f GetProperties(self) ...

Return the properties for the menu as a list of dictionaries

This method is actually recursive. It calls GetProperties() for each of the items. If the item has a sub menu it will call this GetProperties to get the sub menu items.

f GetMenuPath(self, path, path_items=None, appdata=None) ...

Walk the items in this menu to find the item specified by path

See the source for more information.