****************** wx.aui.AuiNotebook ****************** Inheritance diagram for `wx.aui.AuiNotebook`: | .. inheritance-diagram:: wx.aui.AuiNotebook | Description =========== `wx.aui.AuiNotebook` is part of the wxAUI class framework. `wx.aui.AuiNotebook` is a notebook control which implements many features common in applications with dockable panes. Specifically, `wx.aui.AuiNotebook` implements functionality which allows the user to rearrange tab order via drag-and-drop, split the tab window into many different splitter configurations, and toggle through different themes to customize the control's look and feel. An effort has been made to try to maintain an API as similar to that of `wx.Notebook <../Widgets/wx.Notebook.html>`_. The default theme that is used is `wx.aui.AuiDefaultTabArt`, which provides a modern, glossy look and feel. The theme can be changed by calling `SetArtProvider <#SetArtProvider>`_. A simple example on how to use `wx.aui.AuiNotebook`:: class TestPanel(wx.Panel): """ Simple class example for wx.aui.AuiNotebook. """ def __init__(self, parent): """ Class constructor. """ wx.Panel.__init__(self, parent, -1) # Create the wx.aui.AuiNotebook self.nb = wx.aui.AuiNotebook(self) # Create a simple text control page = wx.TextCtrl(self.nb, -1, "Hello World!", style=wx.TE_MULTILINE) # Add the text control as wx.aui.AuiNotebook page self.nb.AddPage(page, "Welcome") # Add some more pages to the wx.aui.AuiNotebook for num in range(1, 5): page = wx.TextCtrl(self.nb, -1, "This is page %d" % num, style=wx.TE_MULTILINE) self.nb.AddPage(page, "Tab Number %d" % num) # Put the wx.aui.AuiNotebook in a sizer and # assign the sizer to the main panel sizer = wx.BoxSizer() sizer.Add(self.nb, 1, wx.EXPAND) self.SetSizer(sizer) # Create a wx.App instance app = wx.App(0) # This is our main application frame frame = wx.Frame(None, -1, "wx.aui.AuiNotebook Sample") panel = TestPanel(frame) # Center the frame and show it frame.CenterOnScreen() frame.Show() # Run the MainLoop(), we are done. app.MainLoop() Derived From ^^^^^^^^^^^^^ * `wx.Control <../Widgets/wx.Control.html>`_ Known Subclasses ^^^^^^^^^^^^^^^^ `wx.aui.AuiMDIClientWindow` Window Styles ^^^^^^^^^^^^^ ================================================== ================================================== Window Style Description ================================================== ================================================== ``wx.aui.AUI_NB_DEFAULT_STYLE`` Defined as ``wx.aui.AUI_NB_TOP`` | ``wx.aui.AUI_NB_TAB_SPLIT`` | ``wx.aui.AUI_NB_TAB_MOVE`` | ``wx.aui.AUI_NB_SCROLL_BUTTONS`` | ``wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB``. ``wx.aui.AUI_NB_TAB_SPLIT`` Allows the tab control to be split by dragging a tab. ``wx.aui.AUI_NB_TAB_MOVE`` Allows a tab to be moved horizontally by dragging. ``wx.aui.AUI_NB_TAB_EXTERNAL_MOVE`` Allows a tab to be moved to another tab control. ``wx.aui.AUI_NB_TAB_FIXED_WIDTH`` With this style, all tabs have the same width. ``wx.aui.AUI_NB_SCROLL_BUTTONS`` With this style, left and right scroll buttons are displayed. ``wx.aui.AUI_NB_WINDOWLIST_BUTTON`` With this style, a drop-down list of windows is available. ``wx.aui.AUI_NB_CLOSE_BUTTON`` With this style, a close button is available on the tab bar. ``wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB`` With this style, the close button is visible on the active tab. ``wx.aui.AUI_NB_CLOSE_ON_ALL_TABS`` With this style, the close button is visible on all tabs. ``wx.aui.AUI_NB_TOP`` With this style, tabs are drawn along the top of the notebook. ``wx.aui.AUI_NB_BOTTOM`` With this style, tabs are drawn along the bottom of the notebook. ================================================== ================================================== Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `AddPage <#AddPage>`_ * `AdvanceSelection <#AdvanceSelection>`_ * `Create <#Create>`_ * `DeletePage <#DeletePage>`_ * `GetArtProvider <#GetArtProvider>`_ * `GetAuiManager <#GetAuiManager>`_ * `GetHeightForPageHeight <#GetHeightForPageHeight>`_ * `GetPage <#GetPage>`_ * `GetPageBitmap <#GetPageBitmap>`_ * `GetPageCount <#GetPageCount>`_ * `GetPageIndex <#GetPageIndex>`_ * `GetPageText <#GetPageText>`_ * `GetSelection <#GetSelection>`_ * `GetTabCtrlHeight <#GetTabCtrlHeight>`_ * `InsertPage <#InsertPage>`_ * `RemovePage <#RemovePage>`_ * `SetArtProvider <#SetArtProvider>`_ * `SetMeasuringFont <#SetMeasuringFont>`_ * `SetNormalFont <#SetNormalFont>`_ * `SetPageBitmap <#SetPageBitmap>`_ * `SetPageText <#SetPageText>`_ * `SetSelectedFont <#SetSelectedFont>`_ * `SetSelection <#SetSelection>`_ * `SetTabCtrlHeight <#SetTabCtrlHeight>`_ * `SetUniformBitmapSize <#SetUniformBitmapSize>`_ * `ShowWindowMenu <#ShowWindowMenu>`_ * `Split <#Split>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `PageCount <#PageCount>`_ * `Selection <#Selection>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.aui.AUI_NB_DEFAULT_STYLE) Constructor, create a `wx.aui.AuiNotebook`. **Parameters:** * `parent` (`wx.Window <../Widgets/wx.Window.html>`_): The parent window. * `id` (int): The window identifier, may be -1. * `pos` (`wx.Point <../Widgets/wx.Point.html>`_): The `wx.aui.AuiNotebook` position. * `size` (`wx.Size <../Widgets/wx.Size.html>`_): The notebook size. * `style` (long): Window style, see `Window Styles`_. | **Returns:** `wx.aui.AuiNotebook `_ -------- .. method:: AddPage(page, caption, select=False, page=wx.NullBitmap) Adds a page. If the `select` parameter is ``True``, calling this will generate a page change event. **Parameters:** * `page` (`wx.Window <../Widgets/wx.Window.html>`_) * `caption` (string) * `select` (bool) * `bitmap` (`wx.Bitmap <../Widgets/wx.Bitmap.html>`_) | **Returns:** `bool` .. seealso:: `InsertPage <#InsertPage>`_ -------- .. method:: AdvanceSelection(forward=True) Sets the selection to the next or previous page. **Parameters:** * `forward` (bool) -------- .. method:: Create(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.aui.AUI_NB_DEFAULT_STYLE) Creates the `wx.aui.AuiNotebook`. **Parameters:** * `parent` (`wx.Window <../Widgets/wx.Window.html>`_): The parent window. * `id` (int): The window identifier, may be -1. * `pos` (`wx.Point <../Widgets/wx.Point.html>`_): The `wx.aui.AuiNotebook` position. * `size` (`wx.Size <../Widgets/wx.Size.html>`_): The notebook size. * `style` (long): Window style, see `Window Styles`_. | **Returns:** `bool` -------- .. method:: DeletePage(page) Deletes a page at the given index. Calling this method will generate a page change event. **Parameters:** * `page` (long) | **Returns:** `bool` -------- .. method:: GetArtProvider() Returns the associated art provider. | **Returns:** `wx.aui.AuiTabArt `_ -------- .. method:: GetAuiManager() `No docstrings available for this method.` -------- .. method:: GetHeightForPageHeight(pageHeight) Returns the desired height of the notebook for the given page height. Use this to fit the notebook to a given page size. **Parameters:** * `pageHeight` (int) | **Returns:** `int` -------- .. method:: GetPage(page_idx) Returns the page specified by the given index. **Parameters:** * `page_idx` (long) | **Returns:** `wx.Window <../Widgets/wx.Window.html>`_ -------- .. method:: GetPageBitmap(page) Returns the tab bitmap for the page. **Parameters:** * `page` (long) | **Returns:** `wx.Bitmap <../Widgets/wx.Bitmap.html>`_ -------- .. method:: GetPageCount() Returns the number of pages in the notebook. | **Returns:** `long` -------- .. method:: GetPageIndex(page_wnd) Returns the page index for the specified window. If the window is not found in the notebook, ``wx.NOT_FOUND`` is returned. **Parameters:** * `page_wnd` (`wx.Window <../Widgets/wx.Window.html>`_) | **Returns:** `int` -------- .. method:: GetPageText(page) Returns the tab label for the page. **Parameters:** * `page` (long) | **Returns:** `string` -------- .. method:: GetSelection() Returns the currently selected page. | **Returns:** `int` -------- .. method:: GetTabCtrlHeight() Returns the height of the tab control. | **Returns:** `int` -------- .. method:: InsertPage(page_idx, page, caption, select=False, bitmap=wx.NullBitmap) `InsertPage` is similar to `AddPage <#AddPage>`_, but allows the ability to specify the insert location. If the `select` parameter is ``True``, calling this will generate a page change event. **Parameters:** * `page_idx` (long) * `page` (`wx.Window <../Widgets/wx.Window.html>`_) * `caption` (string) * `select` (bool) * `bitmap` (`wx.Bitmap <../Widgets/wx.Bitmap.html>`_) | **Returns:** `bool` .. seealso:: `AddPage <#AddPage>`_ -------- .. method:: RemovePage(page) Removes a page, without deleting the window pointer. **Parameters:** * `page` (long) | **Returns:** `bool` -------- .. method:: SetArtProvider(art) Sets the art provider to be used by the notebook. **Parameters:** * `art` (`wx.aui.AuiTabArt `_) -------- .. method:: SetMeasuringFont(font) Sets the font for measuring tab labels. **Parameters:** * `font` (`wx.Font <../Widgets/wx.Font.html>`_) -------- .. method:: SetNormalFont(font) Sets the font for drawing unselected tab labels. **Parameters:** * `font` (`wx.Font <../Widgets/wx.Font.html>`_) -------- .. method:: SetPageBitmap(page, bitmap) Sets the bitmap for the page. To remove a bitmap from the tab caption, pass `wx.NullBitmap`. **Parameters:** * `page` (long) * `bitmap` (`wx.Bitmap <../Widgets/wx.Bitmap.html>`_) | **Returns:** `bool` -------- .. method:: SetPageText(page, text) Sets the tab label for the page. **Parameters:** * `page` (long) * `text` (string) | **Returns:** `bool` -------- .. method:: SetSelectedFont(font) Sets the font for drawing selected tab labels. **Parameters:** * `font` (`wx.Font <../Widgets/wx.Font.html>`_) -------- .. method:: SetSelection(new_page) Sets the page selection. Calling this method will generate a page change event. **Parameters:** * `new_page` (long) | **Returns:** `long` -------- .. method:: SetTabCtrlHeight(height) Sets the tab height. By default, the tab control height is calculated by measuring the text height and bitmap sizes on the tab captions. Calling this method will override that calculation and set the tab control to the specified height parameter. A call to this method will override any call to `SetUniformBitmapSize <#SetUniformBitmapSize>`_. Specifying -1 as the height will return the control to its default auto-sizing behaviour. **Parameters:** * `height` (int) -------- .. method:: SetUniformBitmapSize(size) Ensures that all tabs will have the same height, even if some tabs don't have bitmaps. Passing `wx.DefaultSize` to this function will instruct the control to use dynamic tab height, which is the default behaviour. Under the default behaviour, when a tab with a large bitmap is added, the tab control's height will automatically increase to accommodate the larger bitmap. **Parameters:** * `size` (`wx.Size <../Widgets/wx.Size.html>`_) -------- .. method:: ShowWindowMenu() Shows the window menu for the active tab control associated with this notebook, and returns ``True`` if a selection was made. | **Returns:** `bool` -------- .. method:: Split(page, direction) Split performs a split operation programmatically. **Parameters:** * `page` (int): Indicates the page that will be split off. This page will also become the active page after the split. * `direction` (int): Specifies where the pane should go, it should be one of the following: ``wx.TOP``, ``wx.BOTTOM``, ``wx.LEFT``, or ``wx.RIGHT``. -------- Properties ^^^^^^^^^^ .. attribute:: PageCount See `GetPageCount <#GetPageCount>`_ .. attribute:: Selection See `GetSelection <#GetSelection>`_ and `SetSelection <#SetSelection>`_