wx.aui.AuiNotebook is part of the AUI
class framework, which represents a notebook control, managing multiple windows with associated tabs.
See also AUI Overview.
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.
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 wx.aui.AuiNotebook.SetArtProvider
.
This class supports the following styles:
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_MIDDLE_CLICK_CLOSE
.
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_MIDDLE_CLICK_CLOSE
: With this style, middle click on a tab closes the tab.
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.
Handlers bound for the following event types will receive a wx.aui.AuiNotebookEvent parameter.
EVT_AUINOTEBOOK_PAGE_CLOSE: A page is about to be closed. Processes a wxEVT_AUINOTEBOOK_PAGE_CLOSE
event.
EVT_AUINOTEBOOK_PAGE_CLOSED(winid, fn): A page has been closed. Processes a wxEVT_AUINOTEBOOK_PAGE_CLOSED
event.
EVT_AUINOTEBOOK_PAGE_CHANGED: The page selection was changed. Processes a wxEVT_AUINOTEBOOK_PAGE_CHANGED
event.
EVT_AUINOTEBOOK_PAGE_CHANGING: The page selection is about to be changed. Processes a wxEVT_AUINOTEBOOK_PAGE_CHANGING
event. This event can be vetoed.
EVT_AUINOTEBOOK_BUTTON: The window list button has been pressed. Processes a wxEVT_AUINOTEBOOK_BUTTON
event.
EVT_AUINOTEBOOK_BEGIN_DRAG: Dragging is about to begin. Processes a wxEVT_AUINOTEBOOK_BEGIN_DRAG
event.
EVT_AUINOTEBOOK_END_DRAG: Dragging has ended. Processes a wxEVT_AUINOTEBOOK_END_DRAG
event.
EVT_AUINOTEBOOK_DRAG_MOTION: Emitted during a drag and drop operation. Processes a wxEVT_AUINOTEBOOK_DRAG_MOTION
event.
EVT_AUINOTEBOOK_ALLOW_DND: Whether to allow a tab to be dropped. Processes a wxEVT_AUINOTEBOOK_ALLOW_DND
event. This event must be specially allowed.
EVT_AUINOTEBOOK_DRAG_DONE(winid, fn): Notify that the tab has been dragged. Processes a wxEVT_AUINOTEBOOK_DRAG_DONE
event.
EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN(winid, fn): The middle mouse button is pressed on a tab. Processes a wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN
event.
EVT_AUINOTEBOOK_TAB_MIDDLE_UP(winid, fn): The middle mouse button is released on a tab. Processes a wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP
event.
EVT_AUINOTEBOOK_TAB_RIGHT_DOWN(winid, fn): The right mouse button is pressed on a tab. Processes a wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN
event.
EVT_AUINOTEBOOK_TAB_RIGHT_UP(winid, fn): The right mouse button is released on a tab. Processes a wxEVT_AUINOTEBOOK_TAB_RIGHT_UP
event.
EVT_AUINOTEBOOK_BG_DCLICK(winid, fn): Double clicked on the tabs background area. Processes a wxEVT_AUINOTEBOOK_BG_DCLICK
event.
Default constructor. |
|
Adds a page. |
|
Sets the selection to the next or previous page. |
|
Changes the selection for the given page, returning the previous selection. |
|
Creates the notebook window. |
|
Deletes all pages. |
|
Deletes a page at the given index. |
|
Finds tab control associated with a given window and its tab index. |
|
Returns active tab control for this notebook. |
|
Returns the associated art provider. |
|
Returns the currently selected page or |
|
Returns the desired height of the notebook for the given page height. |
|
Returns the page specified by the given index. |
|
Returns the tab bitmap for the page. |
|
Returns the number of pages in the notebook. |
|
Returns the image index for the given page. |
|
Returns the page index for the specified window. |
|
Returns the tab label for the page. |
|
Returns the tooltip for the tab label of the page. |
|
Returns the currently selected page. |
|
Returns tab control based on point coordinates inside the tab frame. |
|
Returns the height of the tab control. |
|
|
|
Removes a page, without deleting the window pointer. |
|
Sets the art provider to be used by the notebook. |
|
Sets the font for drawing the tab labels, using a bold version of the font for selected tab labels. |
|
Sets the font for measuring tab labels. |
|
Sets the font for drawing unselected tab labels. |
|
Sets the bitmap for the page. |
|
Sets the image index for the given page. |
|
Sets the tab label for the page. |
|
Sets the tooltip displayed when hovering over the tab label of the page. |
|
Sets the font for drawing selected tab labels. |
|
Sets the page selection. |
|
Sets the tab height. |
|
Ensure that all tabs have the same height, even if some of them don’t have bitmaps. |
|
Shows the window menu for the active tab control associated with this notebook, and returns |
|
Split performs a split operation programmatically. |
See |
|
See |
|
See |
|
See |
|
See |
|
See |
Possible constructors:
AuiNotebook() -> None
AuiNotebook(parent : Window, id: int=ID_ANY, pos: Point=DefaultPosition,
size: Size=DefaultSize, style: int=AUI_NB_DEFAULT_STYLE) -> None
AuiNotebook is part of the AUI
class framework, which represents a
notebook control, managing multiple windows with associated tabs.
__init__ (self)
Default constructor.
None
__init__ (self, parent : Window, id: int=ID_ANY, pos: Point=DefaultPosition, size: Size=DefaultSize, style: int=AUI_NB_DEFAULT_STYLE)
Constructor.
Creates a AuiNotebok control.
None
AddPage (self, page : Window, caption : str, select: bool=False, bitmap: BitmapBundle=BitmapBundle())
Adds a page.
If the select
parameter is True
, calling this will generate a page change event.
page (wx.Window)
caption (string)
select (bool)
bitmap (wx.BitmapBundle)
bool
AddPage (self, page : Window, text : str, select : bool, imageId : int)
Adds a new page.
The page must have the book control itself as the parent and must not have been added to this control previously.
The call to this function may generate the page changing events.
page (wx.Window) – Specifies the new page.
text (string) – Specifies the text for the new page.
select (bool) – Specifies whether the page should be selected.
imageId (int) – Specifies the optional image index for the new page.
bool
True
if successful, False
otherwise.
Added in version 2.9.3.
Note
Do not delete the page, it will be deleted by the book control.
See also
Sets the selection to the next or previous page.
forward (bool)
None
Changes the selection for the given page, returning the previous selection.
This function behaves as SetSelection
but does not generate the page changing events.
See User Generated Events vs Programmatically Generated Events for more information.
n (int)
int
Added in version 2.9.3.
Creates the notebook window.
Deletes all pages.
bool
Added in version 2.9.3.
Deletes a page at the given index.
Calling this method will generate a page change event.
page (int)
bool
Finds tab control associated with a given window and its tab index.
page (wx.Window)
ctrl (AuiTabCtrl)
idx (int)
bool
True
when the tab control is found, False
otherwise.
Added in version 4.1/wxWidgets-3.1.4.
Returns active tab control for this notebook.
Added in version 4.1/wxWidgets-3.1.4.
Returns the associated art provider.
variant (WindowVariant)
VisualAttributes
Returns the currently selected page or None
.
Window
Added in version 2.9.3.
Returns the desired height of the notebook for the given page height.
Use this to fit the notebook to a given page size.
pageHeight (int)
int
Returns the page specified by the given index.
page_idx (int)
Window
Returns the tab bitmap for the page.
page (int)
Bitmap
Returns the number of pages in the notebook.
int
Returns the image index for the given page.
nPage (int)
int
Returns the page index for the specified window.
If the window is not found in the notebook, wx.NOT_FOUND
is returned.
This is AUI-specific equivalent to BookCtrl.FindPage() and it is recommended to use that generic method instead of this one.
page_wnd (wx.Window)
int
Returns the tab label for the page.
page (int)
str
Returns the tooltip for the tab label of the page.
pageIdx (int)
str
Added in version 2.9.4.
Returns the currently selected page.
int
Returns tab control based on point coordinates inside the tab frame.
pt (wx.Point)
Added in version 4.1/wxWidgets-3.1.4.
Returns the height of the tab control.
int
InsertPage (self, page_idx : int, page : Window, caption : str, select: bool=False, bitmap: BitmapBundle=BitmapBundle())
InsertPage
is similar to AddPage, but allows the ability to specify the insert location.
If the select
parameter is True
, calling this will generate a page change event.
page_idx (int)
page (wx.Window)
caption (string)
select (bool)
bitmap (wx.BitmapBundle)
bool
InsertPage (self, index : int, page : Window, text : str, select : bool, imageId : int)
Inserts a new page at the specified position.
index (int) – Specifies the position for the new page.
page (wx.Window) – Specifies the new page.
text (string) – Specifies the text for the new page.
select (bool) – Specifies whether the page should be selected.
imageId (int) – Specifies the optional image index for the new page.
bool
True
if successful, False
otherwise.
Added in version 2.9.3.
Note
Do not delete the page, it will be deleted by the book control.
See also
Removes a page, without deleting the window pointer.
page (int)
bool
Sets the art provider to be used by the notebook.
art (wx.aui.AuiTabArt)
None
Sets the font for drawing the tab labels, using a bold version of the font for selected tab labels.
font (wx.Font)
bool
Sets the font for measuring tab labels.
font (wx.Font)
None
Sets the font for drawing unselected tab labels.
font (wx.Font)
None
Sets the bitmap for the page.
To remove a bitmap from the tab caption, pass an empty wx.BitmapBundle.
page (int)
bitmap (wx.BitmapBundle)
bool
Sets the image index for the given page.
image is an index into the image list which was set with SetImageList
.
n (int)
imageId (int)
bool
Added in version 2.9.3.
Sets the tab label for the page.
page (int)
text (string)
bool
Sets the tooltip displayed when hovering over the tab label of the page.
page (int)
text (string)
bool
True
if tooltip was updated, False
if it failed, e.g. because the page index is invalid.
Added in version 2.9.4.
Sets the font for drawing selected tab labels.
font (wx.Font)
None
Sets the page selection.
Calling this method will generate a page change event.
new_page (int)
int
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
.
Specifying -1 as the height will return the control to its default auto-sizing behaviour.
height (int)
None
Ensure that all tabs have the same height, even if some of them don’t have bitmaps.
Passing wx.DefaultSize
as size undoes the effect of a previous call to this function and instructs the control to use dynamic tab height.
size (wx.Size)
None
Shows the window menu for the active tab control associated with this notebook, and returns True
if a selection was made.
bool
Split performs a split operation programmatically.
The argument page indicates the page that will be split off. This page will also become the active page after the split.
The direction argument specifies where the pane should go, it should be one of the following: wx.TOP
, wx.BOTTOM
, wx.LEFT
, or wx.RIGHT
.
page (int)
direction (int)
None
See GetActiveTabCtrl
See GetArtProvider
and SetArtProvider
See GetCurrentPage
See GetPageCount
See GetSelection
and SetSelection
See GetTabCtrlHeight
and SetTabCtrlHeight