wx.lib.agw.aui.auibook.AuiNotebook¶
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 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 Hierarchy¶
Control Appearance¶
Known Subclasses¶
wx.lib.agw.aui.tabmdi.AuiMDIClientWindow
Known Superclasses¶
Methods Summary¶
Default class constructor. |
|
Adds a control inside a tab (not in the tab area). |
|
Adds a page. If the |
|
Adds a button in the tab area. |
|
Cycles through the tabs. |
|
Sets the image list for the |
|
Calculates the size of the new split. |
|
Calculates the tab control area height. |
|
Clones the tab area buttons when the |
|
Deletes a page at the given index. Calling this method will generate a page |
|
Destroys the window safely. |
|
Performs all sizing operations in each tab control. |
|
Starts the editing of an item label, sending a |
|
Enables/disables a page in the notebook. |
|
Ensures the input page index indx is visible. |
|
Finds the next active tab (used mainly when |
|
Finds the tab control that currently contains the window as well |
|
Float the page in page_index by reparenting it to a floating frame. |
|
Returns the active tab control. It is called to determine which control |
|
Returns the AGW-specific style of the window. |
|
Returns the associated art provider. |
|
Returns the associated |
|
Returns the currently active page (not the index), or |
|
Returns the default border style for |
|
Returns whether the page specified by the index page_idx is enabled. |
|
Gets the height of the notebook for a given page height. |
|
Returns whether the page specified by the index page_idx is hidden. |
|
Returns the associated image list (if any). |
|
Returns the minimum and the maximum tab widths for |
|
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. If the window is not |
|
Returns the |
|
Returns the tab label for the page. |
|
Returns the tab text colour for the page. |
|
Returns the tab tooltip for the page. |
|
Returns whether a splitted |
|
Returns the index of the currently active page, or -1 if none was selected. |
|
Returns the number of pages shown in the notebook. |
|
Returns the instance of |
|
Returns the tab control at the specified point. |
|
Returns the tab control height. |
|
Returns the tab frame associated with a tab control. |
|
Returns the tab frame associated with a window. |
|
Returns whether a tab displays a close button or not. |
|
This method should be overridden to return |
|
Hides all tabs on the |
|
Sets whether a page is hidden. |
|
Contains common initialization code called by all constructors. |
|
This is similar to |
|
Returns whether the mouse is well outside the |
|
Returns whether a tab can be renamed or not. |
|
Loads a layout which was saved with |
|
Generates a preview of all the pages in the notebook (MSW and GTK only). |
|
Handles the |
|
Handles the |
|
Handles the |
|
Called by |
|
Called by |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Handles the |
|
Re-docks a floating |
|
Removes a control from a tab (not from the tab area). |
|
Removes all the empty tab frames. |
|
Removes a page, without deleting the window pointer. |
|
Removes a button from the tab area. |
|
Reparents a control added inside a tab. |
|
Called by |
|
Saves the entire user interface layout into an encoded string, which can then |
|
Sets the AGW-specific style of the window. |
|
Sets the art provider to be used by the notebook. |
|
Sets whether a tab should display a close button or not. |
|
Sets the tab font. |
|
Sets the image list for the |
|
Sets the font for calculating text measurements. |
|
Sets the minimum and/or the maximum tab widths for |
|
Sets the icon used by the |
|
Sets the normal font for drawing tab labels. |
|
Sets the tab bitmap for the page. |
|
Sets the image index for the given page. |
|
Sets the tab label for the page. |
|
Sets the tab text colour for the page. |
|
Sets the tab tooltip for the page. |
|
Sets whether a tab can be renamed via a left double-click or not. |
|
Sets whether to unsplit a splitted |
|
Sets the selected tab font for drawing tab labels. |
|
Sets the page selection. Calling this method will generate a page change event. |
|
Sets the selection based on the input page. |
|
Sets the selection based on the input window win. |
|
Sets the tab height. |
|
Ensures that all tabs will have the same height, even if some tabs don’t have bitmaps. |
|
Shows the window menu for the active tab control associated with this |
|
Performs a split operation programmatically. |
|
Restores original view after a tab split. |
|
Unsplit the |
|
Updates the |
|
|
Properties Summary¶
|
Class API¶
- class AuiNotebook(wx.Panel)¶
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
Notebook
.The default theme that is used is
AuiDefaultTabArt
, which provides a modern, glossy look and feel. The theme can be changed by callingAuiNotebook.SetArtProvider
.
Methods¶
- __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=AUI_NB_DEFAULT_STYLE, name='AuiNotebook')¶
Default class constructor.
- Parameters:
parent (wx.Window) – the
AuiNotebook
parent;id (integer) – an identifier for the control: a value of -1 is taken to mean a default;
pos (wx.Point) – the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform;
size (wx.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 (integer) – the underlying
Panel
window style;agwStyle (integer) – the AGW-specific window style. This can be a combination of the following 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
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 clickAUI_NB_SUB_NOTEBOOK
This style is used by
AuiManager
to create automatic AuiNotebooksAUI_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 WindowsAUI_NB_USE_IMAGES_DROPDOWN
Uses images on dropdown window list menu instead of check items
AUI_NB_CLOSE_ON_TAB_LEFT
Draws the tab close button on the left instead of on the right (a la Camino browser)
AUI_NB_TAB_FLOAT
Allows the floating of single tabs. Known limitation: when the notebook is more or less full screen, tabs cannot be dragged far enough outside of the notebook to become floating pages
AUI_NB_DRAW_DND_TAB
Draws an image representation of a tab while dragging (on by default)
AUI_NB_ORDER_BY_ACCESS
Tab navigation order by last access time for the tabs
AUI_NB_NO_TAB_FOCUS
Don’t draw tab focus rectangle
Default value for agwStyle 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
|AUI_NB_DRAW_DND_TAB
name (string) – the window name.
- AddControlToPage(self, page_idx, control)¶
Adds a control inside a tab (not in the tab area).
- AddPage(self, page, caption, select=False, bitmap=wx.NullBitmap, disabled_bitmap=wx.NullBitmap, control=None, tooltip='')¶
Adds a page. If the
select
parameter isTrue
, calling this will generate a page change event.- Parameters:
page (wx.Window) – the page to be added;
caption (string) – specifies the text for the new page;
select (bool) – specifies whether the page should be selected;
bitmap (wx.Bitmap) – the bitmap to display in the enabled tab;
disabled_bitmap (wx.Bitmap) – the bitmap to display in the disabled tab;
control (wx.Window) – almost any
wx.Window
-derived instance to be located inside a tab;tooltip (string) – the tooltip to display when the mouse hovers over the tab.
- AddTabAreaButton(self, id, location, normal_bitmap=wx.NullBitmap, disabled_bitmap=wx.NullBitmap, name='')¶
Adds a button in the tab area.
- Parameters:
id (integer) – the button identifier. This can be one of the following:
Button Identifier
Description
AUI_BUTTON_CLOSE
Shows a close button on the tab area
AUI_BUTTON_WINDOWLIST
Shows a window list button on the tab area
AUI_BUTTON_LEFT
Shows a left button on the tab area
AUI_BUTTON_RIGHT
Shows a right button on the tab area
location (integer) – the button location. Can be
wx.LEFT
orwx.RIGHT
;normal_bitmap (wx.Bitmap) – the bitmap for an enabled tab;
disabled_bitmap (wx.Bitmap) – the bitmap for a disabled tab;
name (string) – the button name.
- AdvanceSelection(self, forward=True, wrap=True)¶
Cycles through the tabs.
- Parameters:
forward (bool) – whether to advance forward or backward;
wrap (bool) –
True
to return to the first tab if we reach the last tab.
Note
The call to this function generates the page changing events.
- AssignImageList(self, imageList)¶
Sets the image list for the
AuiNotebook
control.- Parameters:
imageList – an instance of
wx.ImageList
.
- CalculateNewSplitSize(self)¶
Calculates the size of the new split.
- CalculateTabCtrlHeight(self)¶
Calculates the tab control area height.
- CloneTabAreaButtons(self)¶
Clones the tab area buttons when the
AuiNotebook
is being split.See also
Note
Standard buttons for
AuiNotebook
are not cloned, only custom ones.
- DeletePage(self, page_idx)¶
Deletes a page at the given index. Calling this method will generate a page change event.
- Parameters:
page_idx (integer) – the page index to be deleted.
Note
DeletePage
removes a tab from the multi-notebook, and destroys the window as well.See also
- Destroy(self)¶
Destroys the window safely.
Use this function instead of the
del
operator, since different window classes can be destroyed differently. Frames and dialogs are not destroyed immediately when this function is called – they are added to a list of windows to be deleted on idle time, when all the window’s events have been processed. This prevents problems with events being sent to non-existent windows.- Returns:
True
if the window has either been successfully deleted, or it has been added to the list of windows pending real deletion.
Note
This method has been added to safely un-initialize the underlying
AuiManager
which manages theAuiNotebook
layout (i.e., tab split, re-ordering, tab floating etc…).
- DoSizing(self)¶
Performs all sizing operations in each tab control.
- EditTab(self, page_index)¶
Starts the editing of an item label, sending a
EVT_AUINOTEBOOK_BEGIN_LABEL_EDIT
event.- Parameters:
page_index (integer) – the page index we want to edit.
- EnableTab(self, page_idx, enable=True)¶
Enables/disables a page in the notebook.
- Parameters:
page_idx (integer) – the page index;
enable (bool) –
True
to enable the page,False
to disable it.
- EnsureVisible(self, indx)¶
Ensures the input page index indx is visible.
- Parameters:
indx (integer) – the page index.
- FindNextActiveTab(self, idx)¶
Finds the next active tab (used mainly when
AuiNotebook
has inactive/disabled tabs in it).- Parameters:
idx (integer) – the index of the first (most obvious) tab to check for active status;
- FindTab(self, page)¶
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, otherwiseFalse
.- Parameters:
page – an instance of
AuiNotebookPage
.
- FloatPage(self, page_index)¶
Float the page in page_index by reparenting it to a floating frame.
- Parameters:
page_index (integer) – the index of the page to be floated.
Warning
When the notebook is more or less full screen, tabs cannot be dragged far enough outside of the notebook to become floating pages.
- GetActiveTabCtrl(self)¶
Returns the active tab control. It is called to determine which control gets new windows being added.
- GetAGWWindowStyleFlag(self)¶
Returns the AGW-specific style of the window.
See also
SetAGWWindowStyleFlag
for a list of possible AGW-specific window styles.
- GetArtProvider(self)¶
Returns the associated art provider.
- GetAuiManager(self)¶
Returns the associated
AuiManager
.
- GetCurrentPage(self)¶
Returns the currently active page (not the index), or
None
if none was selected.
- GetDefaultBorder(self)¶
Returns the default border style for
AuiNotebook
.
- GetEnabled(self, page_idx)¶
Returns whether the page specified by the index page_idx is enabled.
- Parameters:
page_idx (integer) – the page index.
- GetHeightForPageHeight(self, pageHeight)¶
Gets the height of the notebook for a given page height.
- Parameters:
pageHeight (integer) – the given page height.
- GetHidden(self, page_idx)¶
Returns whether the page specified by the index page_idx is hidden.
- Parameters:
page_idx (integer) – the page index.
- GetImageList(self)¶
Returns the associated image list (if any).
- GetMinMaxTabWidth(self)¶
Returns the minimum and the maximum tab widths for
AuiNotebook
when theAUI_NB_TAB_FIXED_WIDTH
style is defined.Note
Minimum and maximum tabs widths are used only when the
AUI_NB_TAB_FIXED_WIDTH
style is present.See also
SetMinMaxTabWidth
for more information.
- GetPage(self, page_idx)¶
Returns the page specified by the given index.
- Parameters:
page_idx (integer) – the page index.
- GetPageBitmap(self, page_idx)¶
Returns the tab bitmap for the page.
- Parameters:
page_idx (integer) – the page index.
- GetPageCount(self)¶
Returns the number of pages in the notebook.
- GetPageImage(self, page)¶
Returns the image index for the given page.
- Parameters:
page (integer) – the given page for which to retrieve the image index.
- GetPageIndex(self, 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) – the window we are looking for.
- GetPageInfo(self, page_idx)¶
Returns the
AuiNotebookPage
info structure specified by the given index.- Parameters:
page_idx (integer) – the page index.
- GetPageText(self, page_idx)¶
Returns the tab label for the page.
- Parameters:
page_idx (integer) – the page index.
- GetPageTextColour(self, page_idx)¶
Returns the tab text colour for the page.
- Parameters:
page_idx (integer) – the page index.
- GetPageTooltip(self, page_idx)¶
Returns the tab tooltip for the page.
- Parameters:
page_idx (integer) – the page index.
- GetSashDClickUnsplit(self)¶
Returns whether a splitted
AuiNotebook
can be unsplitted by double-clicking on the splitter sash.
- GetSelection(self)¶
Returns the index of the currently active page, or -1 if none was selected.
- GetShownPageCount(self)¶
Returns the number of pages shown in the notebook.
- GetTabContainer(self)¶
Returns the instance of
AuiTabContainer
.
- GetTabCtrlFromPoint(self, pt)¶
Returns the tab control at the specified point.
- Parameters:
pt (wx.Point) – the mouse location.
- GetTabCtrlHeight(self)¶
Returns the tab control height.
- GetTabFrameFromTabCtrl(self, tab_ctrl)¶
Returns the tab frame associated with a tab control.
- Parameters:
tab_ctrl – an instance of
AuiTabCtrl
.
- GetTabFrameFromWindow(self, wnd)¶
Returns the tab frame associated with a window.
- HasCloseButton(self, page_idx)¶
Returns whether a tab displays a close button or not.
- Parameters:
page_idx (integer) – the page index.
Note
This can only be called if
AUI_NB_CLOSE_ON_ALL_TABS
is specified.
- HasMultiplePages(self)¶
This method should be overridden to return
True
if this window has multiple pages. All standard class with multiple pages such asNotebook
,Listbook
andTreebook
already override it to returnTrue
and user-defined classes with similar behaviour should do it as well to allow the library to handle such windows appropriately.Note
Overridden from
Panel
.
- HideAllTabs(self, hidden=True)¶
Hides all tabs on the
AuiNotebook
control.- Parameters:
hidden (bool) – if
True
hides all tabs.
- HidePage(self, page_idx, hidden=True)¶
Sets whether a page is hidden.
- Parameters:
page_idx (integer) – the page index;
hidden (bool) –
True
to hide the page,False
to show it.
- InitNotebook(self, agwStyle)¶
Contains common initialization code called by all constructors.
- Parameters:
agwStyle (integer) – the notebook style.
See also
__init__
for a list of available agwStyle bits.
- InsertPage(self, page_idx, page, caption, select=False, bitmap=wx.NullBitmap, disabled_bitmap=wx.NullBitmap, control=None, tooltip='')¶
This is similar to
AddPage
, but allows the ability to specify the insert location.- Parameters:
page_idx (integer) – specifies the position for the new page;
page (wx.Window) – the page to be added;
caption (string) – specifies the text for the new page;
select (bool) – specifies whether the page should be selected;
bitmap (wx.Bitmap) – the bitmap to display in the enabled tab;
disabled_bitmap (wx.Bitmap) – the bitmap to display in the disabled tab;
control (wx.Window) – almost any
wx.Window
-derived instance to be located inside a ;tooltip (string) – the tooltip to display when the mouse hovers over the tab.
- IsMouseWellOutsideWindow(self)¶
Returns whether the mouse is well outside the
AuiNotebook
screen rectangle.
- IsRenamable(self, page_idx)¶
Returns whether a tab can be renamed or not.
- Parameters:
page_idx (integer) – the page index.
- Returns:
True
is a page can be renamed,False
otherwise.
- LoadPerspective(self, layout)¶
Loads a layout which was saved with
SavePerspective
.- Parameters:
layout (string) – a string which contains a saved
AuiNotebook
layout.
- NotebookPreview(self, thumbnail_size=200)¶
Generates a preview of all the pages in the notebook (MSW and GTK only).
- Parameters:
thumbnail_size (integer) – the maximum size of every page thumbnail (default=200 pixels).
Note
this functionality is currently unavailable on wxMAC.
- OnChildFocusNotebook(self, event)¶
Handles the
wx.EVT_CHILD_FOCUS
event forAuiNotebook
.- Parameters:
event – a
ChildFocusEvent
event to be processed.
- OnCloseFloatingPage(self, event)¶
Handles the
wx.EVT_CLOSE
event for a floating page inAuiNotebook
.- Parameters:
event – a
CloseEvent
event to be processed.
Handles the
wx.EVT_NAVIGATION_KEY
event forAuiNotebook
.- Parameters:
event – a
NavigationKeyEvent
event to be processed.
- OnRenameAccept(self, page_index, value)¶
Called by
TabTextCtrl
, to accept the changes and to send theEVT_AUINOTEBOOK_END_LABEL_EDIT
event.- Parameters:
page_index (integer) – the page index in the notebook;
value (string) – the new label for the tab.
- OnRenameCancelled(self, page_index)¶
Called by
TabTextCtrl
, to cancel the changes and to send theEVT_AUINOTEBOOK_END_LABEL_EDIT
event.- Parameters:
page_index (integer) – the page index in the notebook.
- OnSize(self, event)¶
Handles the
wx.EVT_SIZE
event forAuiNotebook
.- Parameters:
event – a
wx.SizeEvent
event to be processed.
- OnTabBeginDrag(self, event)¶
Handles the
EVT_AUINOTEBOOK_BEGIN_DRAG
event forAuiNotebook
.- Parameters:
event – a
AuiNotebookEvent
event to be processed.
- OnTabBgDClick(self, event)¶
Handles the
EVT_AUINOTEBOOK_BG_DCLICK
event forAuiNotebook
.- Parameters:
event – a
AuiNotebookEvent
event to be processed.
- OnTabButton(self, event)¶
Handles the
EVT_AUINOTEBOOK_BUTTON
event forAuiNotebook
.- Parameters:
event – a
AuiNotebookEvent
event to be processed.
- OnTabCancelDrag(self, event)¶
Handles the
EVT_AUINOTEBOOK_CANCEL_DRAG
event forAuiNotebook
.- Parameters:
event – a
AuiNotebookEvent
event to be processed.
- OnTabClicked(self, event)¶
Handles the
EVT_AUINOTEBOOK_PAGE_CHANGING
event forAuiNotebook
.- Parameters:
event – a
AuiNotebookEvent
event to be processed.
- OnTabDClick(self, event)¶
Handles the
EVT_AUINOTEBOOK_TAB_DCLICK
event forAuiNotebook
.- Parameters:
event – a
AuiNotebookEvent
event to be processed.
- OnTabDragMotion(self, event)¶
Handles the
EVT_AUINOTEBOOK_DRAG_MOTION
event forAuiNotebook
.- Parameters:
event – a
AuiNotebookEvent
event to be processed.
- OnTabEndDrag(self, event)¶
Handles the
EVT_AUINOTEBOOK_END_DRAG
event forAuiNotebook
.- Parameters:
event – a
AuiNotebookEvent
event to be processed.
- OnTabMiddleDown(self, event)¶
Handles the
EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN
event forAuiNotebook
.- Parameters:
event – a
AuiNotebookEvent
event to be processed.
- OnTabMiddleUp(self, event)¶
Handles the
EVT_AUINOTEBOOK_TAB_MIDDLE_UP
event forAuiNotebook
.- Parameters:
event – a
AuiNotebookEvent
event to be processed.
- OnTabRightDown(self, event)¶
Handles the
EVT_AUINOTEBOOK_TAB_RIGHT_DOWN
event forAuiNotebook
.- Parameters:
event – a
AuiNotebookEvent
event to be processed.
- OnTabRightUp(self, event)¶
Handles the
EVT_AUINOTEBOOK_TAB_RIGHT_UP
event forAuiNotebook
.- Parameters:
event – a
AuiNotebookEvent
event to be processed.
- ReDockPage(self, pane)¶
Re-docks a floating
AuiNotebook
tab in the original position, when possible.- Parameters:
pane – an instance of
AuiPaneInfo
.
- RemoveControlFromPage(self, page_idx)¶
Removes a control from a tab (not from the tab area).
- Parameters:
page_idx (integer) – the page index.
- RemoveEmptyTabFrames(self)¶
Removes all the empty tab frames.
- RemovePage(self, page_idx)¶
Removes a page, without deleting the window pointer.
- Parameters:
page_idx (integer) – the page index to be removed.
Note
RemovePage
removes a tab from the multi-notebook, but does not destroy the window.See also
- RemoveTabAreaButton(self, id)¶
Removes a button from the tab area.
- Parameters:
id (integer) – the button identifier.
See also
AddTabAreaButton
for a list of button identifiers.
- ReparentControl(self, control, dest_tabs)¶
Reparents a control added inside a tab.
- Parameters:
control (wx.Window) – almost any
wx.Window
-derived instance to be located inside a tab;dest_tabs – the destination
AuiTabCtrl
.
- ResetTextControl(self)¶
Called by
TabTextCtrl
when it marks itself for deletion.
- SavePerspective(self)¶
Saves the entire user interface layout into an encoded string, which can then be stored by the application (probably using
Config
). When a perspective is restored usingLoadPerspective
, the entire user interface will return to the state it was when the perspective was saved.
- SetAGWWindowStyleFlag(self, agwStyle)¶
Sets the AGW-specific style of the window.
- Parameters:
agwStyle (integer) – the new window style. This can be a combination of the following 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
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 clickAUI_NB_SUB_NOTEBOOK
This style is used by
AuiManager
to create automatic AuiNotebooksAUI_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 WindowsAUI_NB_USE_IMAGES_DROPDOWN
Uses images on dropdown window list menu instead of check items
AUI_NB_CLOSE_ON_TAB_LEFT
Draws the tab close button on the left instead of on the right (a la Camino browser)
AUI_NB_TAB_FLOAT
Allows the floating of single tabs. Known limitation: when the notebook is more or less full screen, tabs cannot be dragged far enough outside of the notebook to become floating pages
AUI_NB_DRAW_DND_TAB
Draws an image representation of a tab while dragging (on by default)
AUI_NB_ORDER_BY_ACCESS
Tab navigation order by last access time for the tabs
AUI_NB_NO_TAB_FOCUS
Don’t draw tab focus rectangle
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.Todo
Implementation of flags
AUI_NB_RIGHT
andAUI_NB_LEFT
.
- SetArtProvider(self, art)¶
Sets the art provider to be used by the notebook.
- Parameters:
art – an art provider.
- SetCloseButton(self, page_idx, hasCloseButton)¶
Sets whether a tab should display a close button or not.
- Parameters:
page_idx (integer) – the page index;
hasCloseButton (bool) –
True
if the page displays a close button.
Note
This can only be called if
AUI_NB_CLOSE_ON_ALL_TABS
is specified.
- SetFont(self, font)¶
Sets the tab font.
- Parameters:
font (wx.Font) – the new font to use to draw tab labels in their normal, un-selected state.
Note
Overridden from
Panel
.
- SetImageList(self, imageList)¶
Sets the image list for the
AuiNotebook
control.- Parameters:
imageList (wx.ImageList) – the bitmap image list to associate to
AuiNotebook
.
- SetMeasuringFont(self, font)¶
Sets the font for calculating text measurements.
- Parameters:
font (wx.Font) – the new font to use to measure tab label text extents.
- SetMinMaxTabWidth(self, minTabWidth, maxTabWidth)¶
Sets the minimum and/or the maximum tab widths for
AuiNotebook
when theAUI_NB_TAB_FIXED_WIDTH
style is defined.Pass -1 to either minTabWidth or maxTabWidth to reset to the default tab width behaviour for
AuiNotebook
.- Parameters:
minTabWidth (integer) – the minimum allowed tab width, in pixels;
maxTabWidth (integer) – the maximum allowed tab width, in pixels.
Note
Minimum and maximum tabs widths are used only when the
AUI_NB_TAB_FIXED_WIDTH
style is present.
Sets the icon used by the
TabNavigatorWindow
.- Parameters:
bmp (wx.Bitmap) – the new bitmap for the
TabNavigatorWindow
.
- SetNormalFont(self, font)¶
Sets the normal font for drawing tab labels.
- Parameters:
font (wx.Font) – the new font to use to draw tab labels in their normal, un-selected state.
- SetPageBitmap(self, page_idx, bitmap)¶
Sets the tab bitmap for the page.
- Parameters:
page_idx (integer) – the page index;
bitmap (wx.Bitmap) – the bitmap to display on the page tab.
- SetPageImage(self, page, image)¶
Sets the image index for the given page.
- Parameters:
page (integer) – the page index;
image (integer) – an index into the image list which was set with
SetImageList
.
- SetPageText(self, page_idx, text)¶
Sets the tab label for the page.
- Parameters:
page_idx (integer) – the page index;
text (string) – the new tab label.
- SetPageTextColour(self, page_idx, colour)¶
Sets the tab text colour for the page.
- Parameters:
page_idx (integer) – the page index;
colour (wx.Colour) – the new tab label text colour.
- SetPageTooltip(self, page_idx, tooltip)¶
Sets the tab tooltip for the page.
- Parameters:
page_idx (integer) – the page index;
tooltip (string) – the new tooltip.
- Returns:
True
if the page tooltip has been set,False
otherwise (for example when the input page_idx is greater than the number of pages in the notebook.
- SetRenamable(self, page_idx, renamable)¶
Sets whether a tab can be renamed via a left double-click or not.
- Parameters:
page_idx (integer) – the page index;
renamable (bool) –
True
if the page can be renamed.
- SetSashDClickUnsplit(self, unsplit=True)¶
Sets whether to unsplit a splitted
AuiNotebook
when double-clicking on a sash.- Parameters:
unsplit (bool) –
True
to unsplit on sash double-clicking,False
otherwise.
- SetSelectedFont(self, font)¶
Sets the selected tab font for drawing tab labels.
- Parameters:
font (wx.Font) – the new font to use to draw tab labels in their selected state.
- SetSelection(self, new_page, force=False)¶
Sets the page selection. Calling this method will generate a page change event.
- Parameters:
new_page (integer) – the index of the new selection;
force (bool) – whether to force the selection or not.
- SetSelectionToPage(self, page)¶
Sets the selection based on the input page.
- Parameters:
page – an instance of
AuiNotebookPage
.
- SetSelectionToWindow(self, win)¶
Sets the selection based on the input window win.
- Parameters:
win – a
wx.Window
derived window.
- SetTabCtrlHeight(self, 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
. Specifying -1 as the height will return the control to its default auto-sizing behaviour.- Parameters:
height (integer) – the tab control area height.
- SetUniformBitmapSize(self, size)¶
Ensures that all tabs will have the same height, even if some tabs don’t have bitmaps. Passing
wx.DefaultSize
to this method 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) – the tab bitmap size.
- ShowWindowMenu(self)¶
Shows the window menu for the active tab control associated with this notebook, and returns
True
if a selection was made.
- Split(self, page, direction)¶
Performs a split operation programmatically.
- Parameters:
page (integer) – indicates the page that will be split off. This page will also become the active page after the split.
direction (integer) – specifies where the pane should go, it should be one of the following:
wx.TOP
,wx.BOTTOM
,wx.LEFT
, orwx.RIGHT
.
- UnSplit(self)¶
Restores original view after a tab split.
- UnsplitDClick(self, part, sash_size, pos)¶
Unsplit the
AuiNotebook
on sash double-click.- Parameters:
part – an UI part representing the sash;
sash_size (integer) – the sash size;
pos (wx.Point) – the double-click mouse position.
Warning
Due to a bug on MSW, for disabled pages
FindWindowAtPoint
returns the wrong window. See http://trac.wxwidgets.org/ticket/2942
- UpdateHintWindowSize(self)¶
Updates the
AuiManager
hint window size.
- UpdateTabCtrlHeight(self, force=False)¶
UpdateTabCtrlHeight
does the actual tab resizing. It’s meant to be used internally.- Parameters:
force (bool) –
True
to force the tab art to repaint.