TrackPopupMenu((x,y), flags, owner)

Creates a popup menu anywhere on the screen.


(x,y) : (int, int)

The position for the menu..

flags=win32con.TPM_LEFTALIGN|win32con.TPM_LEFTBUTTON|win32con.TPM_RIGHTBUTTON : int

Flags for the menu.

owner=(main application frame) : PyCWnd

The owner of the menu.


The TrackPopupMenu function displays a floating pop-up menu at the specified location and tracks the selection of items on the pop-up menu. The floating pop-up menu can appear anywhere on the screen.

Return Value

If the underlying MFC function fails, but TPM_RETURNCMD is set in the flags parameter, then None is returned instead of the normal exception.