auibook.AuiNotebook

Inheritance diagram for AuiNotebook:


digraph inheritance8212698eef {
rankdir=LR;
size="8.0, 12.0";
  "wx._controls.PyControl" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25];
  "wx._core.Control" -> "wx._controls.PyControl" [arrowsize=0.5,style="setlinewidth(0.5)"];
  "wx._core.Window" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25];
  "wx._core.EvtHandler" -> "wx._core.Window" [arrowsize=0.5,style="setlinewidth(0.5)"];
  "wx._core.Object" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25];
  "wx._core.EvtHandler" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25];
  "wx._core.Object" -> "wx._core.EvtHandler" [arrowsize=0.5,style="setlinewidth(0.5)"];
  "wx._core.Control" [shape=box,style="setlinewidth(0.5)",fontsize=10,fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25];
  "wx._core.Window" -> "wx._core.Control" [arrowsize=0.5,style="setlinewidth(0.5)"];
  "auibook.AuiNotebook" [style="setlinewidth(0.5)",URL="#auibook.AuiNotebook",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,height=0.25,shape=box,fontsize=10];
  "wx._controls.PyControl" -> "auibook.AuiNotebook" [arrowsize=0.5,style="setlinewidth(0.5)"];
}


Description

AuiNotebook is a notebook control which implements many features common in applications with dockable panes. Specifically, 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.

The default theme that is used is AuiDefaultTabArt, which provides a modern, glossy look and feel. The theme can be changed by calling AuiNotebook.SetArtProvider.

Class API

Methods

class AuiNotebook(parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=10545)

Bases: wx._controls.PyControl

AuiNotebook is a notebook control which implements many features common in applications with dockable panes. Specifically, 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.

The default theme that is used is AuiDefaultTabArt, which provides a modern, glossy look and feel. The theme can be changed by calling AuiNotebook.SetArtProvider.

__init__()

Default class constructor.

Parameters:
  • parent – the L{AuiNotebook} parent;
  • id – an identifier for the control: a value of -1 is taken to mean a default;
  • pos – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
  • size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
  • style – the window style. This can be a combination of the bollowing bits:
Flag name Description
AUI_NB_TOP With this style, tabs are drawn along the top of the notebook
AUI_NB_LEFT With this style, tabs are drawn along the left of the notebook. Not implemented yet.
AUI_NB_RIGHT With this style, tabs are drawn along the right of the notebook. Not implemented yet.
AUI_NB_BOTTOM With this style, tabs are drawn along the bottom of the notebook. Not implemented for the Chrome tab art.
AUI_NB_TAB_SPLIT Allows the tab control to be split by dragging a tab
AUI_NB_TAB_MOVE Allows a tab to be moved horizontally by dragging
AUI_NB_TAB_EXTERNAL_MOVE Allows a tab to be moved to another tab control
AUI_NB_TAB_FIXED_WIDTH With this style, all tabs have the same width
AUI_NB_SCROLL_BUTTONS With this style, left and right scroll buttons are displayed
AUI_NB_WINDOWLIST_BUTTON With this style, a drop-down list of windows is available
AUI_NB_CLOSE_BUTTON With this style, a close button is available on the tab bar
AUI_NB_CLOSE_ON_ACTIVE_TAB With this style, a close button is available on the active tab
AUI_NB_CLOSE_ON_ALL_TABS With this style, a close button is available on all tabs
AUI_NB_MIDDLE_CLICK_CLOSE Allows to close AuiNotebook tabs by mouse middle button click
AUI_NB_SUB_NOTEBOOK This style is used by AuiManager to create automatic AuiNotebooks
AUI_NB_HIDE_ON_SINGLE_TAB Hides the tab window if only one tab is present
AUI_NB_SMART_TABS Use Smart Tabbing, like Alt+Tab on Windows
AUI_NB_USE_IMAGES_DROPDOWN Uses images on dropdown window list menu instead of check items

Default value for style is: AUI_NB_DEFAULT_STYLE = AUI_NB_TOP |

AUI_NB_TAB_SPLIT | AUI_NB_TAB_MOVE | AUI_NB_SCROLL_BUTTONS | AUI_NB_CLOSE_ON_ACTIVE_TAB | AUI_NB_MIDDLE_CLICK_CLOSE
AddPage(page, caption, select=False, bitmap=<wx._gdi.Bitmap; proxy of <Swig Object of type 'wxBitmap *' at 0x3045078> >, disabled_bitmap=<wx._gdi.Bitmap; proxy of <Swig Object of type 'wxBitmap *' at 0x3045078> >)

Adds a page. If the select parameter is True, calling this will generate a page change event.

Parameters:
  • page – the page to be added;
  • caption – specifies the text for the new page;
  • select – specifies whether the page should be selected;
  • bitmap – the wx.Bitmap to display in the enabled tab;
  • disabled_bitmap – the wx.Bitmap to display in the disabled tab.
AdvanceSelection(forward=True)

Cycles through the tabs. The call to this function generates the page changing events.

Parameter:forward – whether to advance forward or backward.
CalculateNewSplitSize()
Calculates the size of the new split.
CalculateTabCtrlHeight()
Calculates the tab control area height.
DeletePage(page_idx)

Deletes a page at the given index. Calling this method will generate a page change event.

Parameter:page_idx – the page index to be deleted.

@note: DeletePage() removes a tab from the multi-notebook, and destroys the window as well.

DoSizing()
Performs all sizing operations in each tab control.
EnableTab(page_idx, enable=True)

Enables/disables a page in the notebook.

Parameters:
  • page_idx – the page index;
  • enable – True to enable the page, False to disable it.
EnsureVisible(indx)

Ensures the input page index indx is visible.

Parameter:indx – the page index.
FindTab(page)

FindTab() finds the tab control that currently contains the window as well as the index of the window in the tab control. It returns True if the window was found, otherwise False.

Parameter:page – an instance of L{AuiNotebookPage}.
GetActiveTabCtrl()
GetActiveTabCtrl() returns the active tab control. It is called to determine which control gets new windows being added.
GetArtProvider()
Returns the associated art provider.
GetAuiManager()
Returns the associated L{AuiManager}.
GetCurrentPage()
Returns the currently active page (not the index).
GetDefaultBorder()
Returns the default border style for L{AuiNotebook}.
GetEnabled(page_idx)

Returns whether the page specified by the index page_idx is enabled.

Parameter:page_idx – the page index.
GetHeightForPageHeight(pageHeight)

Gets the height of the notebook for a given page height.

Parameter:pageHeight – the given page height.
GetPage(page_idx)

Returns the page specified by the given index.

Parameter:page_idx – the page index.
GetPageBitmap(page_idx)

Returns the tab bitmap for the page.

Parameter:page_idx – the page index.
GetPageCount()
Returns the number of pages in the notebook.
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.
GetPageText(page_idx)

Returns the tab label for the page.

Parameter:page_idx – the page index.
GetPageTextColour(page_idx)

Returns the tab text colour for the page.

Parameter:page_idx – the page index.
GetSelection()
Returns the index of the currently active page.
GetTabCtrlFromPoint(pt)

Returns the tab control at the specified point.

Parameter:pt – a wx.Point object.
GetTabCtrlHeight()
Returns the tab control height.
GetTabFrameFromTabCtrl(tab_ctrl)

Returns the tab frame associated with a tab control.

Parameter:tab_ctrl – an instance of L{AuiTabCtrl}.
HasMultiplePages()
Overridden from wx.PyControl.
InitNotebook(style)

InitNotebook() contains common initialization code called by all constructors.

Parameter:style – the notebook style. See L{__init__} for more details.
InsertPage(page_idx, page, caption, select=False, bitmap=<wx._gdi.Bitmap; proxy of <Swig Object of type 'wxBitmap *' at 0x3045078> >, disabled_bitmap=<wx._gdi.Bitmap; proxy of <Swig Object of type 'wxBitmap *' at 0x3045078> >)

This is similar to L{AddPage}, but allows the ability to specify the insert location.

Parameters:
  • page_idx – specifies the position for the new page;
  • page – the page to be added;
  • caption – specifies the text for the new page;
  • select – specifies whether the page should be selected;
  • bitmap – the wx.Bitmap to display in the enabled tab;
  • disabled_bitmap – the wx.Bitmap to display in the disabled tab.
OnChildFocusNotebook(event)

Handles the wx.EVT_CHILD_FOCUS event for L{AuiNotebook}.

Parameter:event – a L{wx.ChildFocusEvent} event to be processed.
OnNavigationKeyNotebook(event)

Handles the wx.EVT_NAVIGATION_KEY event for L{AuiNotebook}.

Parameter:event – a L{wx.NavigationKeyEvent} event to be processed.
OnSize(event)

Handles the wx.EVT_SIZE event for L{AuiNotebook}.

Parameter:event – a L{wx.SizeEvent} event to be processed.
OnTabBeginDrag(event)

Handles the EVT_AUINOTEBOOK_BEGIN_DRAG event for L{AuiNotebook}.

Parameter:event – a L{wx.EVT_AUINOTEBOOK_BEGIN_DRAG} event to be processed.
OnTabBgDClick(event)

Handles the EVT_AUINOTEBOOK_BG_DCLICK event for L{AuiNotebook}.

Parameter:event – a L{wx.EVT_AUINOTEBOOK_BG_DCLICK} event to be processed.
OnTabButton(event)

Handles the EVT_AUINOTEBOOK_BUTTON event for L{AuiNotebook}.

Parameter:event – a EVT_AUINOTEBOOK_BUTTON event to be processed.
OnTabCancelDrag(event)

Handles the EVT_AUINOTEBOOK_CANCEL_DRAG event for L{AuiNotebook}.

Parameter:event – a L{wx.EVT_AUINOTEBOOK_CANCEL_DRAG} event to be processed.
OnTabClicked(event)

Handles the EVT_AUINOTEBOOK_PAGE_CHANGING event for L{AuiNotebook}.

Parameter:event – a L{wx.EVT_AUINOTEBOOK_PAGE_CHANGING} event to be processed.
OnTabDClick(event)

Handles the EVT_AUINOTEBOOK_TAB_DCLICK event for L{AuiNotebook}.

Parameter:event – a L{wx.EVT_AUINOTEBOOK_TAB_DCLICK} event to be processed.
OnTabDragMotion(event)

Handles the EVT_AUINOTEBOOK_DRAG_MOTION event for L{AuiNotebook}.

Parameter:event – a L{wx.EVT_AUINOTEBOOK_DRAG_MOTION} event to be processed.
OnTabEndDrag(event)

Handles the EVT_AUINOTEBOOK_END_DRAG event for L{AuiNotebook}.

Parameter:event – a L{wx.EVT_AUINOTEBOOK_END_DRAG} event to be processed.
OnTabMiddleDown(event)

Handles the EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN event for L{AuiNotebook}.

Parameter:event – a EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN event to be processed.
OnTabMiddleUp(event)

Handles the EVT_AUINOTEBOOK_TAB_MIDDLE_UP event for L{AuiNotebook}.

Parameter:event – a EVT_AUINOTEBOOK_TAB_MIDDLE_UP event to be processed.
OnTabRightDown(event)

Handles the EVT_AUINOTEBOOK_TAB_RIGHT_DOWN event for L{AuiNotebook}.

Parameter:event – a EVT_AUINOTEBOOK_TAB_RIGHT_DOWN event to be processed.
OnTabRightUp(event)

Handles the EVT_AUINOTEBOOK_TAB_RIGHT_UP event for L{AuiNotebook}.

Parameter:event – a EVT_AUINOTEBOOK_TAB_RIGHT_UP event to be processed.
RemoveEmptyTabFrames()
Removes all the empty tab frames.
RemovePage(page_idx)

Removes a page, without deleting the window pointer.

Parameter:page_idx – the page index to be removed.

@note: DeletePage() removes a tab from the multi-notebook, but does not destroys the window.

SetArtProvider(art)

Sets the art provider to be used by the notebook.

Parameter:art – an art provider.
SetFont(font)

Overridden from wx.PyControl. Sets the tab font.

Parameter:font – a wx.Font object.
SetMeasuringFont(font)

Sets the font for calculating text measurements.

Parameter:font – a wx.Font object.
SetNavigatorIcon(bmp)

Sets the icon used by the L{TabNavigatorWindow}.

Parameter:bitmap – an instance of wx.Bitmap.
SetNormalFont(font)

Sets the normal font for drawing tab labels.

Parameter:font – a wx.Font object.
SetPageBitmap(page_idx, bitmap)

Sets the tab bitmap for the page.

Parameters:
  • page_idx – the page index;
  • bitmap – an instance of wx.Bitmap.
SetPageText(page_idx, text)

Sets the tab label for the page.

Parameters:
  • page_idx – the page index;
  • text – the new tab label.
SetPageTextColour(page_idx, colour)

Sets the tab text colour for the page.

Parameters:
  • page_idx – the page index;
  • colour – an instance of wx.Colour.
SetSelectedFont(font)

Sets the selected tab font for drawing tab labels.

Parameter:font – a wx.Font object.
SetSelection(new_page, force=False)

Sets the page selection. Calling this method will generate a page change event.

Parameters:
  • new_page – the index of the new selection;
  • force – whether to force the selection or not.
SetSelectionToPage(page)

Sets the selection based on the input page.

Parameter:page – an instance of L{AuiNotebookPage}.
SetSelectionToWindow(win)

Sets the selection based on the input window win.

Parameter:win – a wx.Window derived window.
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 L{SetUniformBitmapSize}. Specifying -1 as the height will return the control to its default auto-sizing behaviour.

Parameter:height – the tab control area height.
SetUniformBitmapSize(size)

SetUniformBitmapSize() 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.

Parameter:size – an instance of wx.Size specifying the tab bitmap size.
SetWindowStyleFlag(style)

Overridden from wx.PyControl. Sets the style of the window.

Parameter:style – the new window style.

@note: Please note that some styles cannot be changed after the window creation and that Refresh might need to be be called after changing the others for the change to take place immediately.

ShowWindowMenu()
Shows the window menu for the active tab control associated with this notebook, and returns True if a selection was made.
Split(page, direction)

Split performs a split operation programmatically.

Parameters:
  • page – indicates the page that will be split off. This page will also become the active page after the split.
  • direction – specifies where the pane should go, it should be one of the following: wx.TOP, wx.BOTTOM, wx.LEFT, or wx.RIGHT.
UnSplit()
Restores original view after Tab Splits.
UpdateHintWindowSize()
Updates the L{AuiManager} hint window size.
UpdateTabCtrlHeight(force=False)

UpdateTabCtrlHeight() does the actual tab resizing. It’s meant to be used interally.

Parameter:force – force the tab art to repaint.

Table Of Contents

This Page