wxPython defines a few standard command identifiers which may be used by the user code and also are sometimes used by wxPython itself. These reserved identifiers are all in the range between wx.ID_LOWEST and wx.ID_HIGHEST and, accordingly, the user code should avoid defining its own constants in this range.
- wx.ID_LOWEST = 4999, wx.ID_OPEN, wx.ID_CLOSE, wx.ID_NEW, wx.ID_SAVE, wx.ID_SAVEAS, wx.ID_REVERT, wx.ID_EXIT, wx.ID_UNDO, wx.ID_REDO, wx.ID_HELP, wx.ID_PRINT, wx.ID_PRINT_SETUP, wx.ID_PAGE_SETUP, wx.ID_PREVIEW, wx.ID_ABOUT, wx.ID_HELP_CONTENTS, wx.ID_HELP_INDEX, wx.ID_HELP_SEARCH, wx.ID_HELP_COMMANDS, wx.ID_HELP_PROCEDURES, wx.ID_HELP_CONTEXT, wx.ID_CLOSE_ALL, wx.ID_EDIT = 5030, wx.ID_CUT, wx.ID_COPY, wx.ID_PASTE, wx.ID_CLEAR, wx.ID_FIND, wx.ID_DUPLICATE, wx.ID_SELECTALL, wx.ID_DELETE, wx.ID_REPLACE, wx.ID_REPLACE_ALL, wx.ID_PROPERTIES, wx.ID_VIEW_DETAILS, wx.ID_VIEW_LARGEICONS, wx.ID_VIEW_SMALLICONS, wx.ID_VIEW_LIST, wx.ID_VIEW_SORTDATE, wx.ID_VIEW_SORTNAME, wx.ID_VIEW_SORTSIZE, wx.ID_VIEW_SORTTYPE, wx.ID_FILE = 5050, wx.ID_FILE1, wx.ID_FILE2, wx.ID_FILE3, wx.ID_FILE4, wx.ID_FILE5, wx.ID_FILE6, wx.ID_FILE7, wx.ID_FILE8, wx.ID_FILE9, // Standard button IDs wx.ID_OK = 5100, wx.ID_CANCEL, wx.ID_APPLY, wx.ID_YES, wx.ID_NO, wx.ID_STATIC, wx.ID_FORWARD, wx.ID_BACKWARD, wx.ID_DEFAULT, wx.ID_MORE, wx.ID_SETUP, wx.ID_RESET, wx.ID_CONTEXT_HELP, wx.ID_YESTOALL, wx.ID_NOTOALL, wx.ID_ABORT, wx.ID_RETRY, wx.ID_IGNORE, wx.ID_UP, wx.ID_DOWN, wx.ID_HOME, wx.ID_REFRESH, wx.ID_STOP, wx.ID_INDEX, wx.ID_BOLD, wx.ID_ITALIC, wx.ID_JUSTIFY_CENTER, wx.ID_JUSTIFY_FILL, wx.ID_JUSTIFY_RIGHT, wx.ID_JUSTIFY_LEFT, wx.ID_UNDERLINE, wx.ID_INDENT, wx.ID_UNINDENT, wx.ID_ZOOM_100, wx.ID_ZOOM_FIT, wx.ID_ZOOM_IN, wx.ID_ZOOM_OUT, wx.ID_UNDELETE, wx.ID_REVERT_TO_SAVED, // System menu IDs (used by wx.Univ): wx.ID_SYSTEM_MENU = 5200, wx.ID_CLOSE_FRAME, wx.ID_MOVE_FRAME, wx.ID_RESIZE_FRAME, wx.ID_MAXIMIZE_FRAME, wx.ID_ICONIZE_FRAME, wx.ID_RESTORE_FRAME, // IDs used by generic file dialog (13 consecutive starting from this value) wx.ID_FILEDLGG = 5900, wx.ID_HIGHEST = 5999
Those are Stock IDs. They should be used for menus and buttons for common items that the represent so that wx can take care of some cross platform differences for you automatically (especially for wxMac).
Using the stock id will allow for wx to automatically specify the correct text (localized if available) for the item:
wx.Button(panel, wx.ID_COPY) # Note no need to specify the label
See the StockButtons example in the demo and the optimizing for mac article in the wiki for some further info.
ID_FILE-ID_FILE9 are builtin ids for the when you use a wx.FileHistory menu, for opening the most recent items.
The stock IDs can be used anywhere an ID is needed, and in some cases will trigger special or platform specific behavior. For example on wxGTK menu items or buttons with stock IDs will automatically be given an icon from the current theme (if the theme uses icons for menus and buttons) and on Mac menu items with the stock about, exit and preferences IDs will be moved to the application menu.
You can also do things like get stock labels from the stock IDs with wx.GetStockLabel, etc. Or you can let wx do it for you by creating the items with no label and just specify the stock ID.
Question: Is wx.ID_EDIT for a menu or menu item?
Answer: Menus don't use IDs, just menu items.