.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.Menu:

==========================================================================================================================================
|phoenix_title|  **wx.Menu**
==========================================================================================================================================

A menu is a popup (or pull down) list of items, one of which may be selected before the menu goes away (clicking elsewhere dismisses the menu).          

Menus may be used to construct either menu bars or popup menus. 

A menu item has an integer ``ID`` associated with it which can be used to identify the selection, or to change the menu item in some way. A menu item with a special identifier ``wx.ID_SEPARATOR``  is a separator item and doesn't have an associated command but just makes a separator line appear in the menu. 


Menu items may be either  `normal`  items, `check`  items or `radio`  items. Normal items don't have any special properties while the check items have a boolean flag associated to them and they show a checkmark in the menu when the flag is set. wxWidgets automatically toggles the flag value when the item is clicked and its value may be retrieved using either :meth:`wx.Menu.IsChecked`   method of :ref:`wx.Menu`  or :ref:`wx.MenuBar`  itself or by using `Event.IsChecked` when you get the menu notification for the item in question. 

The radio items are similar to the check items except that all the other items in the same radio group are unchecked when a radio item is checked. The radio group is formed by a contiguous range of radio items, i.e. it starts at the first item of this kind and ends with the first item of a different kind (or the end of the menu). Notice that because the radio groups are defined in terms of the item positions inserting or removing the items in the menu containing the radio items risks to not work correctly. 



|phoenix_title| Allocation strategy
===================================

All menus must be created on the **heap**  because all menus attached to a menubar or to another menu will be deleted by their parent when it is deleted. The only exception to this rule are the popup menus (i.e. menus used with :meth:`wx.Window.PopupMenu` ) as wxWidgets does not destroy them to allow reusing the same menu more than once. But the exception applies only to the menus themselves and not to any submenus of popup menus which are still destroyed by wxWidgets as usual and so must be heap-allocated. As the frame menubar is deleted by the frame itself, it means that normally all menus used are deleted automatically.  



|phoenix_title| Event handling
==============================

If the menu is part of a menubar, then :ref:`wx.MenuBar`  event processing is used. With a popup menu (see :meth:`wx.Window.PopupMenu` ), there is a variety of ways to handle a menu selection event ( ``wxEVT_MENU`` ):

- Provide  ``EVT_MENU``   handlers in the window which pops up the menu, or in an ancestor of that window (the simplest method); 
- Derive a new class from :ref:`wx.Menu`  and define event table entries using the  ``EVT_MENU``   macro; 
- Set a new event handler for :ref:`wx.Menu`, through :meth:`wx.EvtHandler.SetNextHandler` , specifying an object whose class has  ``EVT_MENU``   entries; 


Note that instead of static  ``EVT_MENU``   macros you can also use dynamic connection; see  :ref:`Dynamic Event Handling <dynamic event handling>`.   



.. note:: 

   Please note that ``wx.ID_ABOUT``  and ``wx.ID_EXIT``  are predefined by wxWidgets and have a special meaning since entries using these IDs will be taken out of the normal menus under OS X and will be inserted into the system menu (following the appropriate OS X interface guideline).  







.. seealso:: :ref:`wx.MenuBar`, :meth:`wx.Window.PopupMenu` , :ref:`Events and Event Handling <events and event handling>`, :ref:`wx.FileHistory`     







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>Menu</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.Menu_inheritance.png" alt="Inheritance diagram of Menu" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Object.html" title="wx.Object" alt="" coords="5,5,87,35"/> <area shape="rect" id="node2" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="48,83,159,112"/> <area shape="rect" id="node4" href="wx.Menu.html" title="wx.Menu" alt="" coords="65,160,141,189"/> <area shape="rect" id="node3" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="112,5,213,35"/> </map> 
   </p>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.Menu.__init__`                                                        Constructs a :ref:`wx.Menu`  object.
:meth:`~wx.Menu.Append`                                                          Adds a menu item.
:meth:`~wx.Menu.AppendCheckItem`                                                 Adds a checkable item to the end of the menu.
:meth:`~wx.Menu.AppendRadioItem`                                                 Adds a radio item to the end of the menu.
:meth:`~wx.Menu.AppendSeparator`                                                 Adds a separator to the end of the menu.
:meth:`~wx.Menu.AppendSubMenu`                                                   Adds the given `submenu`  to this menu.
:meth:`~wx.Menu.Attach`                                                          
:meth:`~wx.Menu.Break`                                                           Inserts a break in a menu, causing the next appended item to appear in a new column.
:meth:`~wx.Menu.Check`                                                           Checks or unchecks the menu item.
:meth:`~wx.Menu.Delete`                                                          Deletes the menu item from the menu.
:meth:`~wx.Menu.DestroyItem`                                                     Deletes the menu item from the menu.
:meth:`~wx.Menu.Detach`                                                          
:meth:`~wx.Menu.Enable`                                                          Enables or disables (greys out) a menu item.
:meth:`~wx.Menu.FindChildItem`                                                   Finds the menu item object associated with the given menu item identifier and, optionally, the position of the item in the menu.
:meth:`~wx.Menu.FindItem`                                                        Finds the menu id for a menu item string.
:meth:`~wx.Menu.FindItemById`                                                    FindItemById(id) . MenuItem
:meth:`~wx.Menu.FindItemByPosition`                                              Returns the :ref:`wx.MenuItem`  given a position in the menu.
:meth:`~wx.Menu.GetHelpString`                                                   Returns the help string associated with a menu item.
:meth:`~wx.Menu.GetInvokingWindow`                                               
:meth:`~wx.Menu.GetLabel`                                                        Returns a menu item label.
:meth:`~wx.Menu.GetLabelText`                                                    Returns a menu item label, without any of the original mnemonics and accelerators.
:meth:`~wx.Menu.GetMenuItemCount`                                                Returns the number of items in the menu.
:meth:`~wx.Menu.GetMenuItems`                                                    Returns the list of items in the menu.
:meth:`~wx.Menu.GetParent`                                                       
:meth:`~wx.Menu.GetStyle`                                                        
:meth:`~wx.Menu.GetTitle`                                                        Returns the title of the menu.
:meth:`~wx.Menu.GetWindow`                                                       
:meth:`~wx.Menu.Insert`                                                          Inserts the given `item`  before the position `pos`.
:meth:`~wx.Menu.InsertCheckItem`                                                 Inserts a checkable item at the given position.
:meth:`~wx.Menu.InsertRadioItem`                                                 Inserts a radio item at the given position.
:meth:`~wx.Menu.InsertSeparator`                                                 Inserts a separator at the given position.
:meth:`~wx.Menu.IsAttached`                                                      
:meth:`~wx.Menu.IsChecked`                                                       Determines whether a menu item is checked.
:meth:`~wx.Menu.IsEnabled`                                                       Determines whether a menu item is enabled.
:meth:`~wx.Menu.Prepend`                                                         Inserts the given `item`  at position 0, i.e. before all the other existing items.
:meth:`~wx.Menu.PrependCheckItem`                                                Inserts a checkable item at position 0.
:meth:`~wx.Menu.PrependRadioItem`                                                Inserts a radio item at position 0.
:meth:`~wx.Menu.PrependSeparator`                                                Inserts a separator at position 0.
:meth:`~wx.Menu.Remove`                                                          Removes the menu item from the menu but doesn't delete the associated C++ object.
:meth:`~wx.Menu.SetHelpString`                                                   Sets an item's help string.
:meth:`~wx.Menu.SetInvokingWindow`                                               
:meth:`~wx.Menu.SetLabel`                                                        Sets the label of a menu item.
:meth:`~wx.Menu.SetParent`                                                       
:meth:`~wx.Menu.SetTitle`                                                        Sets the title of the menu.
:meth:`~wx.Menu.UpdateUI`                                                        Sends events to `source`  (or owning window if ``None``) to update the menu UI.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.Menu.InvokingWindow`                                                  See :meth:`~wx.Menu.GetInvokingWindow` and :meth:`~wx.Menu.SetInvokingWindow`
:attr:`~wx.Menu.MenuItemCount`                                                   See :meth:`~wx.Menu.GetMenuItemCount`
:attr:`~wx.Menu.MenuItems`                                                       See :meth:`~wx.Menu.GetMenuItems`
:attr:`~wx.Menu.Parent`                                                          See :meth:`~wx.Menu.GetParent` and :meth:`~wx.Menu.SetParent`
:attr:`~wx.Menu.Style`                                                           See :meth:`~wx.Menu.GetStyle`
:attr:`~wx.Menu.Title`                                                           See :meth:`~wx.Menu.GetTitle` and :meth:`~wx.Menu.SetTitle`
:attr:`~wx.Menu.Window`                                                          See :meth:`~wx.Menu.GetWindow`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.Menu(EvtHandler)

   **Possible constructors**::

       Menu()
       
       Menu(style)
       
       Menu(title, style=0)
       
   
   A menu is a popup (or pull down) list of items, one of which may be
   selected before the menu goes away (clicking elsewhere dismisses the
   menu).



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **__init__** `(self)`
      
      Constructs a :ref:`wx.Menu`  object.                   
      
      
      
      
      **~~~**

      
      **__init__** `(self, style)`
      
      Constructs a :ref:`wx.Menu`  object.                  
      
      
      
      
      :param `style`: If set to ``wx.MENU_TEAROFF``, the menu will be detachable (wxGTK only).   
      :type `style`: long
      
      
      
      
                        
      
      
      
      
      **~~~**

      
      **__init__** `(self, title, style=0)`
      
      Constructs a :ref:`wx.Menu`  object with a title.                  
      
      
      
      
      :param `title`: Title at the top of the menu (not always supported).   
      :type `title`: string
      :param `style`: If set to ``wx.MENU_TEAROFF``, the menu will be detachable (wxGTK only).   
      :type `style`: long
      
      
      
      
      
      
                        
      
      
      
      
      **~~~**






   .. method:: Append(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **Append** `(self, id, item=EmptyString, helpString=EmptyString, kind=ITEM_NORMAL)`
      
      Adds a menu item.                  
      
      
      
      
      :param `id`: The menu command identifier.   
      :type `id`: int
      :param `item`: The string to appear on the menu item. See :meth:`wx.MenuItem.SetItemLabel`   for more details.   
      :type `item`: string
      :param `helpString`: An optional help string associated with the item. By default, the handler for the  ``wxEVT_MENU_HIGHLIGHT``   event displays this string in the status line.    
      :type `helpString`: string
      :param `kind`: May be  ``ITEM_SEPARATOR`` ,   ``ITEM_NORMAL`` ,   ``ITEM_CHECK``   or   ``ITEM_RADIO`` .  
      :type `kind`: wx.ItemKind
      
      
      
      
      
      
      
      
      
      
      
      
      :rtype: :ref:`wx.MenuItem`
      
      
      
      ::
      
                  self.fileMenu.Append(ID_NEW_FILE, "&New file\tCTRL+N", "Creates a XYZ document")
      
      or even better for stock menu items (see :meth:`MenuItem.__init__` ): ::
      
                  self.fileMenu.Append(wx.ID_NEW, "", "Creates a XYZ document")
      
      
      
                       
      
      
      
      .. note:: 
      
         This command can be used after the menu has been shown, as well as on initial creation of a menu or menubar.  
      
      
      
      
      
      
      
      .. seealso:: :meth:`AppendSeparator` , :meth:`AppendCheckItem` , :meth:`AppendRadioItem` , :meth:`AppendSubMenu` , :meth:`Insert` , :meth:`SetLabel` , :meth:`GetHelpString` , :meth:`SetHelpString` , :ref:`wx.MenuItem`    
      
      
      
      
      
      
      
      **~~~**

      
      **Append** `(self, id, item, subMenu, helpString=EmptyString)`
      
      Adds a submenu.                  
      
      
      
      
      
      
      :param `id`: The menu command identifier.   
      :type `id`: int
      :param `item`: The string to appear on the menu item.   
      :type `item`: string
      :param `subMenu`: Pull-right submenu.   
      :type `subMenu`: wx.Menu
      :param `helpString`: An optional help string associated with the item. By default, the handler for the  ``wxEVT_MENU_HIGHLIGHT``   event displays this string in the status line.  
      :type `helpString`: string
      
      
      
      
      
      
      
      
      
      
      
      
      :rtype: :ref:`wx.MenuItem`
      
      
      
                        
      
      
      
      .. wxdeprecated:: 
         This function is deprecated, use :meth:`AppendSubMenu`   instead.   
      
      
      
      
      
      
      
      .. seealso:: :meth:`AppendSeparator` , :meth:`AppendCheckItem` , :meth:`AppendRadioItem` , :meth:`AppendSubMenu` , :meth:`Insert` , :meth:`SetLabel` , :meth:`GetHelpString` , :meth:`SetHelpString` , :ref:`wx.MenuItem`    
      
      
      
      
      
      
      
      **~~~**

      
      **Append** `(self, menuItem)`
      
      Adds a menu item object.                  
      
      This is the most generic variant of :meth:`Append`   method because it may be used for both items (including separators) and submenus and because you can also specify various extra properties of a menu item this way, such as bitmaps and fonts. 
      
      
      
      
      :param `menuItem`: A menuitem object. It will be owned by the :ref:`wx.Menu`  object after this function is called, so do not delete it yourself.  
      :type `menuItem`: wx.MenuItem
      
      
      
      
      
      
      :rtype: :ref:`wx.MenuItem`
      
      
      
                        
      
      
      
      .. note:: 
      
         See the remarks for the other :meth:`Append`   overloads.  
      
      
      
      
      
      
      
      .. seealso:: :meth:`AppendSeparator` , :meth:`AppendCheckItem` , :meth:`AppendRadioItem` , :meth:`AppendSubMenu` , :meth:`Insert` , :meth:`SetLabel` , :meth:`GetHelpString` , :meth:`SetHelpString` , :ref:`wx.MenuItem`    
      
      
      
      
      
      
      
      **~~~**






   .. method:: AppendCheckItem(self, id, item, help=EmptyString)

      Adds a checkable item to the end of the menu.                  

                


      :param `id`: 
      :type `id`: int
      :param `item`: 
      :type `item`: string
      :param `help`: 
      :type `help`: string




      :rtype: :ref:`wx.MenuItem`







      .. seealso:: :meth:`Append` , :meth:`InsertCheckItem`     








   .. method:: AppendRadioItem(self, id, item, help=EmptyString)

      Adds a radio item to the end of the menu.                  

      All consequent radio items form a group and when an item in the group is checked, all the others are automatically unchecked. 

                


      :param `id`: 
      :type `id`: int
      :param `item`: 
      :type `item`: string
      :param `help`: 
      :type `help`: string




      :rtype: :ref:`wx.MenuItem`







      .. note:: 

         Radio items are not supported under Motif.  







      .. seealso:: :meth:`Append` , :meth:`InsertRadioItem`     








   .. method:: AppendSeparator(self)

      Adds a separator to the end of the menu.                  

                

      :rtype: :ref:`wx.MenuItem`







      .. seealso:: :meth:`Append` , :meth:`InsertSeparator`     








   .. method:: AppendSubMenu(self, submenu, text, help=EmptyString)

      Adds the given `submenu`  to this menu.                  

      `text`  is the text shown in the menu for it and `help`  is the help string shown in the status bar when the submenu item is selected. 

                


      :param `submenu`: 
      :type `submenu`: wx.Menu
      :param `text`: 
      :type `text`: string
      :param `help`: 
      :type `help`: string




      :rtype: :ref:`wx.MenuItem`







      .. seealso:: :meth:`Insert` , :meth:`Prepend`     








   .. method:: Attach(self, menubar)




      :param `menubar`: 
      :type `menubar`: wx.MenuBar







   .. method:: Break(self)

      Inserts a break in a menu, causing the next appended item to appear in a new column.                   





   .. method:: Check(self, id, check)

      Checks or unchecks the menu item.                  




      :param `id`: The menu item identifier.   
      :type `id`: int
      :param `check`: If ``True``, the item will be checked, otherwise it will be unchecked.  
      :type `check`: bool






                  



      .. seealso:: :meth:`IsChecked`     








   .. method:: Delete(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **Delete** `(self, id)`
      
      Deletes the menu item from the menu.                  
      
      If the item is a submenu, it will **not**  be deleted. Use :meth:`Destroy`   if you want to delete a submenu. 
      
      
      
      
      :param `id`: Id of the menu item to be deleted.  
      :type `id`: int
      
      
      
      
      
      
      :rtype: `bool`
      
      
      
                        
      
      
      
      .. seealso:: :meth:`FindItem` , :meth:`Destroy` , :meth:`Remove`     
      
      
      
      
      
      
      
      **~~~**

      
      **Delete** `(self, item)`
      
      Deletes the menu item from the menu.                  
      
      If the item is a submenu, it will **not**  be deleted. Use :meth:`Destroy`   if you want to delete a submenu. 
      
      
      
      
      :param `item`: Menu item to be deleted.  
      :type `item`: wx.MenuItem
      
      
      
      
      
      
      :rtype: `bool`
      
      
      
                        
      
      
      
      .. seealso:: :meth:`FindItem` , :meth:`Destroy` , :meth:`Remove`     
      
      
      
      
      
      
      
      **~~~**






   .. method:: DestroyItem(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **DestroyItem** `(self, id)`
      
      Deletes the menu item from the menu.                  
      
      If the item is a submenu, it will be deleted. Use :meth:`Remove`   if you want to keep the submenu (for example, to reuse it later). 
      
      
      
      
      :param `id`: Id of the menu item to be deleted.  
      :type `id`: int
      
      
      
      
      
      
      :rtype: `bool`
      
      
      
                        
      
      
      
      .. seealso:: :meth:`FindItem` , :meth:`Delete` , :meth:`Remove`     
      
      
      
      
      
      
      
      **~~~**

      
      **DestroyItem** `(self, item)`
      
      Deletes the menu item from the menu.                  
      
      If the item is a submenu, it will be deleted. Use :meth:`Remove`   if you want to keep the submenu (for example, to reuse it later). 
      
      
      
      
      :param `item`: Menu item to be deleted.  
      :type `item`: wx.MenuItem
      
      
      
      
      
      
      :rtype: `bool`
      
      
      
                        
      
      
      
      .. seealso:: :meth:`FindItem` , :meth:`Delete` , :meth:`Remove`     
      
      
      
      
      
      
      
      **~~~**






   .. method:: Detach(self)






   .. method:: Enable(self, id, enable)

      Enables or disables (greys out) a menu item.                  




      :param `id`: The menu item identifier.   
      :type `id`: int
      :param `enable`: ``True`` to enable the menu item, ``False`` to disable it.  
      :type `enable`: bool






                  



      .. seealso:: :meth:`IsEnabled`     








   .. method:: FindChildItem(self, id)

      Finds the menu item object associated with the given menu item identifier and, optionally, the position of the item in the menu.                  

      Unlike :meth:`FindItem` , this function doesn't recurse but only looks at the direct children of this menu. 




      :param `id`: The identifier of the menu item to find.   
      :type `id`: int








      :rtype: `tuple`



                  



      :returns: 

         ( :ref:`wx.MenuItem`, `pos` ) 








   .. method:: FindItem(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **FindItem** `(self, itemString)`
      
      Finds the menu id for a menu item string.                  
      
      
      
      
      :param `itemString`: Menu item string to find.  
      :type `itemString`: string
      
      
      
      
      
      
      :rtype: `int`
      
      
      
                        
      
      
      
      :returns: 
      
         Menu item identifier, or ``wx.NOT_FOUND`` if none is found.  
      
      
      
      
      
      
      
      .. note:: 
      
         Any special menu codes are stripped out of source and target strings before matching.   
      
      
      
      
      
      
      
      **~~~**

      
      **FindItem** `(self, id)`
      
      Finds the menu item object associated with the given menu item identifier and, optionally, the (sub)menu it belongs to.                  
      
      
      
      
      :param `id`: Menu item identifier.   
      :type `id`: int
      
      
      
      
      
      
      
      
      :rtype: `tuple`
      
      
      
                        
      
      
      
      :returns: 
      
         ( :ref:`wx.MenuItem`, `menu` ) 
      
      
      
      
      
      
      
      **~~~**






   .. method:: FindItemById(self, id)

                              FindItemById(id) . MenuItem

                              Finds the menu item object associated with the given menu item identifier. 

      :rtype: :ref:`wx.MenuItem`








   .. method:: FindItemByPosition(self, position)

      Returns the :ref:`wx.MenuItem`  given a position in the menu.                  


      :param `position`: 
      :type `position`: int




      :rtype: :ref:`wx.MenuItem`








   .. method:: GetHelpString(self, id)

      Returns the help string associated with a menu item.                  




      :param `id`: The menu item identifier.  
      :type `id`: int






      :rtype: `string`



                  



      :returns: 

         The help string, or the empty string if there is no help string or the item was not found.  







      .. seealso:: :meth:`SetHelpString` , :meth:`Append`     








   .. method:: GetInvokingWindow(self)



      :rtype: :ref:`wx.Window`








   .. method:: GetLabel(self, id)

      Returns a menu item label.                  




      :param `id`: The menu item identifier.  
      :type `id`: int






      :rtype: `string`



                  



      :returns: 

         The item label, or the empty string if the item was not found.  







      .. seealso:: :meth:`GetLabelText` , :meth:`SetLabel`     








   .. method:: GetLabelText(self, id)

      Returns a menu item label, without any of the original mnemonics and accelerators.                  




      :param `id`: The menu item identifier.  
      :type `id`: int






      :rtype: `string`



                  



      :returns: 

         The item label, or the empty string if the item was not found.  







      .. seealso:: :meth:`GetLabel` , :meth:`SetLabel`     








   .. method:: GetMenuItemCount(self)

      Returns the number of items in the menu.                  

      :rtype: `int`








   .. method:: GetMenuItems(self)

      Returns the list of items in the menu.                  

      MenuItemList is a pseudo-template list class containing :ref:`wx.MenuItem`  pointers, see List.                  

      :rtype: :ref:`MenuItemList`








   .. method:: GetParent(self)



      :rtype: :ref:`wx.Menu`








   .. method:: GetStyle(self)



      :rtype: `long`








   .. method:: GetTitle(self)

      Returns the title of the menu.                  

                

      :rtype: `string`







      .. seealso:: :meth:`SetTitle`     








   .. method:: GetWindow(self)



      :rtype: :ref:`wx.Window`








   .. method:: Insert(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **Insert** `(self, pos, menuItem)`
      
      Inserts the given `item`  before the position `pos`.                  
      
      Inserting the item at position :meth:`GetMenuItemCount`   is the same as appending it. 
      
                      
      
      
      :param `pos`: 
      :type `pos`: int
      :param `menuItem`: 
      :type `menuItem`: wx.MenuItem
      
      
      
      
      :rtype: :ref:`wx.MenuItem`
      
      
      
      
      
      
      
      .. seealso:: :meth:`Append` , :meth:`Prepend`     
      
      
      
      
      
      
      
      **~~~**

      
      **Insert** `(self, pos, id, item=EmptyString, helpString=EmptyString, kind=ITEM_NORMAL)`
      
      Inserts the given `item`  before the position `pos`.                  
      
      Inserting the item at position :meth:`GetMenuItemCount`   is the same as appending it. 
      
                      
      
      
      :param `pos`: 
      :type `pos`: int
      :param `id`: 
      :type `id`: int
      :param `item`: 
      :type `item`: string
      :param `helpString`: 
      :type `helpString`: string
      :param `kind`: 
      :type `kind`: wx.ItemKind
      
      
      
      
      :rtype: :ref:`wx.MenuItem`
      
      
      
      
      
      
      
      .. seealso:: :meth:`Append` , :meth:`Prepend`     
      
      
      
      
      
      
      
      **~~~**

      
      **Insert** `(self, pos, id, text, submenu, help=EmptyString)`
      
      Inserts the given `submenu`  before the position `pos`.                  
      
      `text`  is the text shown in the menu for it and `help`  is the help string shown in the status bar when the submenu item is selected. 
      
                      
      
      
      :param `pos`: 
      :type `pos`: int
      :param `id`: 
      :type `id`: int
      :param `text`: 
      :type `text`: string
      :param `submenu`: 
      :type `submenu`: wx.Menu
      :param `help`: 
      :type `help`: string
      
      
      
      
      :rtype: :ref:`wx.MenuItem`
      
      
      
      
      
      
      
      .. seealso:: :meth:`AppendSubMenu` , :meth:`Prepend`     
      
      
      
      
      
      
      
      **~~~**






   .. method:: InsertCheckItem(self, pos, id, item, helpString=EmptyString)

      Inserts a checkable item at the given position.                  

                


      :param `pos`: 
      :type `pos`: int
      :param `id`: 
      :type `id`: int
      :param `item`: 
      :type `item`: string
      :param `helpString`: 
      :type `helpString`: string




      :rtype: :ref:`wx.MenuItem`







      .. seealso:: :meth:`Insert` , :meth:`AppendCheckItem`     








   .. method:: InsertRadioItem(self, pos, id, item, helpString=EmptyString)

      Inserts a radio item at the given position.                  

                


      :param `pos`: 
      :type `pos`: int
      :param `id`: 
      :type `id`: int
      :param `item`: 
      :type `item`: string
      :param `helpString`: 
      :type `helpString`: string




      :rtype: :ref:`wx.MenuItem`







      .. seealso:: :meth:`Insert` , :meth:`AppendRadioItem`     








   .. method:: InsertSeparator(self, pos)

      Inserts a separator at the given position.                  

                


      :param `pos`: 
      :type `pos`: int




      :rtype: :ref:`wx.MenuItem`







      .. seealso:: :meth:`Insert` , :meth:`AppendSeparator`     








   .. method:: IsAttached(self)



      :rtype: `bool`








   .. method:: IsChecked(self, id)

      Determines whether a menu item is checked.                  




      :param `id`: The menu item identifier.  
      :type `id`: int






      :rtype: `bool`



                  



      :returns: 

         ``True`` if the menu item is checked, ``False`` otherwise.  







      .. seealso:: :meth:`Check`     








   .. method:: IsEnabled(self, id)

      Determines whether a menu item is enabled.                  




      :param `id`: The menu item identifier.  
      :type `id`: int






      :rtype: `bool`



                  



      :returns: 

         ``True`` if the menu item is enabled, ``False`` otherwise.  







      .. seealso:: :meth:`Enable`     








   .. method:: Prepend(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **Prepend** `(self, menuItem)`
      
      Inserts the given `item`  at position 0, i.e. before all the other existing items.                  
      
                      
      
      
      :param `menuItem`: 
      :type `menuItem`: wx.MenuItem
      
      
      
      
      :rtype: :ref:`wx.MenuItem`
      
      
      
      
      
      
      
      .. seealso:: :meth:`Append` , :meth:`Insert`     
      
      
      
      
      
      
      
      **~~~**

      
      **Prepend** `(self, id, item=EmptyString, helpString=EmptyString, kind=ITEM_NORMAL)`
      
      Inserts the given `item`  at position 0, i.e. before all the other existing items.                  
      
                      
      
      
      :param `id`: 
      :type `id`: int
      :param `item`: 
      :type `item`: string
      :param `helpString`: 
      :type `helpString`: string
      :param `kind`: 
      :type `kind`: wx.ItemKind
      
      
      
      
      :rtype: :ref:`wx.MenuItem`
      
      
      
      
      
      
      
      .. seealso:: :meth:`Append` , :meth:`Insert`     
      
      
      
      
      
      
      
      **~~~**

      
      **Prepend** `(self, id, text, subMenu, help=EmptyString)`
      
      Inserts the given `submenu`  at position 0.                  
      
                      
      
      
      :param `id`: 
      :type `id`: int
      :param `text`: 
      :type `text`: string
      :param `subMenu`: 
      :type `subMenu`: wx.Menu
      :param `help`: 
      :type `help`: string
      
      
      
      
      :rtype: :ref:`wx.MenuItem`
      
      
      
      
      
      
      
      .. seealso:: :meth:`AppendSubMenu` , :meth:`Insert`     
      
      
      
      
      
      
      
      **~~~**






   .. method:: PrependCheckItem(self, id, item, helpString=EmptyString)

      Inserts a checkable item at position 0.                  

                


      :param `id`: 
      :type `id`: int
      :param `item`: 
      :type `item`: string
      :param `helpString`: 
      :type `helpString`: string




      :rtype: :ref:`wx.MenuItem`







      .. seealso:: :meth:`Prepend` , :meth:`AppendCheckItem`     








   .. method:: PrependRadioItem(self, id, item, helpString=EmptyString)

      Inserts a radio item at position 0.                  

                


      :param `id`: 
      :type `id`: int
      :param `item`: 
      :type `item`: string
      :param `helpString`: 
      :type `helpString`: string




      :rtype: :ref:`wx.MenuItem`







      .. seealso:: :meth:`Prepend` , :meth:`AppendRadioItem`     








   .. method:: PrependSeparator(self)

      Inserts a separator at position 0.                  

                

      :rtype: :ref:`wx.MenuItem`







      .. seealso:: :meth:`Prepend` , :meth:`AppendSeparator`     








   .. method:: Remove(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **Remove** `(self, id)`
      
      Removes the menu item from the menu but doesn't delete the associated C++ object.                  
      
      This allows you to reuse the same item later by adding it back to the menu (especially useful with submenus). 
      
      
      
      
      :param `id`: The identifier of the menu item to remove.  
      :type `id`: int
      
      
      
      
      
      
      :rtype: :ref:`wx.MenuItem`
      
      
      
                        
      
      
      
      :returns: 
      
         A pointer to the item which was detached from the menu.   
      
      
      
      
      
      
      
      **~~~**

      
      **Remove** `(self, item)`
      
      Removes the menu item from the menu but doesn't delete the associated C++ object.                  
      
      This allows you to reuse the same item later by adding it back to the menu (especially useful with submenus). 
      
      
      
      
      :param `item`: The menu item to remove.  
      :type `item`: wx.MenuItem
      
      
      
      
      
      
      :rtype: :ref:`wx.MenuItem`
      
      
      
                        
      
      
      
      :returns: 
      
         A pointer to the item which was detached from the menu.   
      
      
      
      
      
      
      
      **~~~**






   .. method:: SetHelpString(self, id, helpString)

      Sets an item's help string.                  




      :param `id`: The menu item identifier.   
      :type `id`: int
      :param `helpString`: The help string to set.  
      :type `helpString`: string






                  



      .. seealso:: :meth:`GetHelpString`     








   .. method:: SetInvokingWindow(self, win)




      :param `win`: 
      :type `win`: wx.Window







   .. method:: SetLabel(self, id, label)

      Sets the label of a menu item.                  




      :param `id`: The menu item identifier.   
      :type `id`: int
      :param `label`: The menu item label to set.  
      :type `label`: string






                  



      .. seealso:: :meth:`Append` , :meth:`GetLabel`     








   .. method:: SetParent(self, parent)




      :param `parent`: 
      :type `parent`: wx.Menu







   .. method:: SetTitle(self, title)

      Sets the title of the menu.                  




      :param `title`: The title to set.  
      :type `title`: string




                  



      .. note:: 

         Notice that you can only call this method directly for the popup menus, to change the title of a menu that is part of a menu bar you need to use :meth:`wx.MenuBar.SetLabelTop` .  







      .. seealso:: :meth:`GetTitle`     








   .. method:: UpdateUI(self, source=None)

      Sends events to `source`  (or owning window if ``None``) to update the menu UI.                  

      This is called just before the menu is popped up with :meth:`wx.Window.PopupMenu` , but the application may call it at other times if required.                  


      :param `source`: 
      :type `source`: wx.EvtHandler







   .. attribute:: InvokingWindow

      See :meth:`~wx.Menu.GetInvokingWindow` and :meth:`~wx.Menu.SetInvokingWindow`


   .. attribute:: MenuItemCount

      See :meth:`~wx.Menu.GetMenuItemCount`


   .. attribute:: MenuItems

      See :meth:`~wx.Menu.GetMenuItems`


   .. attribute:: Parent

      See :meth:`~wx.Menu.GetParent` and :meth:`~wx.Menu.SetParent`


   .. attribute:: Style

      See :meth:`~wx.Menu.GetStyle`


   .. attribute:: Title

      See :meth:`~wx.Menu.GetTitle` and :meth:`~wx.Menu.SetTitle`


   .. attribute:: Window

      See :meth:`~wx.Menu.GetWindow`

