AGW Logo

agw_title FlatNotebook

The FlatNotebook is a full implementation of the wx.Notebook, and designed to be a drop-in replacement for wx.Notebook. The API functions are similar so one can expect the function to behave in the same way.

hierarchy Inheritance Diagram

Inheritance diagram for: FlatNotebook

Inheritance diagram of FlatNotebook


appearance Control Appearance


FlatNotebook

FlatNotebook


method_summary Methods Summary

__init__Default class constructor.
AddPageAdds a page to the FlatNotebook.
AdvanceSelectionCycles through the tabs.
AssignImageListAssigns the image list for the page control.
DeleteAllPagesDeletes all the pages in the FlatNotebook.
DeletePageDeletes the specified page, and the associated window.
DoGetBestSizeGets the size which best suits the window: for a control, it would be the
EnableTabEnables or disables a tab.
EnsureVisibleEnsures that a tab is visible.
GetAGWWindowStyleFlagReturns the FlatNotebook window style.
GetActiveTabColourReturns the active tab colour.
GetActiveTabTextColourGet the active tab text colour.
GetBorderColourReturns the border colour.
GetCurrentPageReturns the currently selected notebook page or None if none is selected.
GetCustomPageReturns a custom panel to show when there are no pages left in FlatNotebook.
GetEnabledReturns whether a tab is enabled or not.
GetGradientColourBorderGets the tab border colour.
GetGradientColourFromGets first gradient colour.
GetGradientColourToGets second gradient colour.
GetImageListReturns the associated image list.
GetNonActiveTabTextColourReturns the non active tabs text colour.
GetPaddingReturns the amount of space around each page’s icon and label, in pixels.
GetPageReturns the window at the given page position, or None.
GetPageBestSizeReturn the page best size.
GetPageCountReturns the number of pages in the FlatNotebook control.
GetPageImageReturns the image index for the given page.
GetPageIndexReturns the index at which the window is found.
GetPageShapeAngleReturns the angle associated to a tab.
GetPageTextReturns the string for the given page.
GetPageTextColourReturns the tab text colour if it has been set previously, or None otherwise.
GetPreviousSelectionReturns the previous selection.
GetSelectionReturns the currently selected page, or -1 if none was selected.
GetTabAreaReturns the associated page.
GetTabAreaColourReturns the area behind the tabs colour.
GetTileOrientationReturns the orientation when on tiling mode.
HasAGWFlagReturns whether a flag is present in the FlatNotebook style.
HideTabsHides the tabs.
InitInitializes all the class attributes.
InsertPageInserts a new page at the specified position.
OnDropTargetHandles the drop action from a drag and drop operation.
OnNavigationKeyHandles the wx.EVT_NAVIGATION_KEY event for FlatNotebook.
RemovePageDeletes the specified page, without deleting the associated window.
SetAGWWindowStyleFlagSets the FlatNotebook window style flags.
SetActiveTabColourSets the active tab colour.
SetActiveTabTextColourSets the text colour for the active tab.
SetAllPagesShapeAngleSets the angle associated to all the tab.
SetCustomPageSets a custom panel to show when there are no pages left in FlatNotebook.
SetGradientColourBorderSets the tab border colour.
SetGradientColourFromSets the starting colour for the gradient.
SetGradientColourToSets the ending colour for the gradient.
SetGradientColoursSets the gradient colours for the tab.
SetImageListSets the image list for the page control.
SetNavigatorIconSet the icon used by the TabNavigatorWindow.
SetNonActiveTabTextColourSets the non active tabs text colour.
SetPaddingSets the amount of space around each page’s icon and label, in pixels.
SetPageImageSets the image index for the given page.
SetPageShapeAngleSets the angle associated to a tab.
SetPageTextSets the text for the given page.
SetPageTextColourSets the tab text colour individually.
SetRightClickMenuSets the popup menu associated to a right click on a tab.
SetSelectionSets the selection for the given page.
SetTabAreaColourSets the area behind the tabs colour.
ShowCustomPageHides the custom panel which is shown when there are no pages left in FlatNotebook.
ShowTabsShows the tabs if hidden previously.
TileShows pages in column/row mode (one panel after the other in columns/rows).

API Class API

class FlatNotebook(wx.PyPanel)[source]

The FlatNotebook is a full implementation of the wx.Notebook, and designed to be a drop-in replacement for wx.Notebook. The API functions are similar so one can expect the function to behave in the same way.



__init__(parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=0, name="FlatNotebook")[source]

Default class constructor.

Parameters:
  • parent – the FlatNotebook 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 underlying wx.PyPanel window style;
  • agwStyle – the AGW-specific window style. This can be a combination of the following bits:


    Window Styles Hex Value Description
    FNB_VC71 0x1 Use Visual Studio 2003 (VC7.1) style for tabs.
    FNB_FANCY_TABS 0x2 Use fancy style - square tabs filled with gradient colouring.
    FNB_TABS_BORDER_SIMPLE 0x4 Draw thin border around the page.
    FNB_NO_X_BUTTON 0x8 Do not display the ‘X’ button.
    FNB_NO_NAV_BUTTONS 0x10 Do not display the right/left arrows.
    FNB_MOUSE_MIDDLE_CLOSES_TABS 0x20 Use the mouse middle button for cloing tabs.
    FNB_BOTTOM 0x40 Place tabs at bottom - the default is to place them at top.
    FNB_NODRAG 0x80 Disable dragging of tabs.
    FNB_VC8 0x100 Use Visual Studio 2005 (VC8) style for tabs.
    FNB_X_ON_TAB 0x200 Place ‘X’ close button on the active tab.
    FNB_BACKGROUND_GRADIENT 0x400 Use gradients to paint the tabs background.
    FNB_COLOURFUL_TABS 0x800 Use colourful tabs (VC8 style only).
    FNB_DCLICK_CLOSES_TABS 0x1000 Style to close tab using double click.
    FNB_SMART_TABS 0x2000 Use Smart Tabbing, like Alt + Tab on Windows.
    FNB_DROPDOWN_TABS_LIST 0x4000 Use a dropdown menu on the left in place of the arrows.
    FNB_ALLOW_FOREIGN_DND 0x8000 Allows drag ‘n’ drop operations between different FlatNotebook.
    FNB_HIDE_ON_SINGLE_TAB 0x10000 Hides the Page Container when there is one or fewer tabs.
    FNB_DEFAULT_STYLE 0x10020 FlatNotebook default style.
    FNB_FF2 0x20000 Use Firefox 2 style for tabs.
    FNB_NO_TAB_FOCUS 0x40000 Does not allow tabs to have focus.
    FNB_RIBBON_TABS 0x80000 Use the Ribbon Tabs style.
    FNB_HIDE_TABS 0x100000 Hides the Page Container allowing only keyboard navigation
    FNB_NAV_BUTTONS_WHEN_NEEDED 0x200000 Hides the navigation left/right arrows if all tabs fit
  • name – the window name.


AddPage(page, text, select=False, imageId=-1)[source]

Adds a page to the FlatNotebook.

Parameters:
  • page – specifies the new page;
  • text – specifies the text for the new page;
  • select – specifies whether the page should be selected;
  • imageId – specifies the optional image index for the new page.
Returns:

True if successful, False otherwise.



AdvanceSelection(forward=True)[source]

Cycles through the tabs.

Parameters:forward – if True, the selection is advanced in ascending order (to the right), otherwise the selection is advanced in descending order.

Note

The call to this function generates the page changing events.



AssignImageList(imageList)[source]

Assigns the image list for the page control.

Parameters:imageList – an instance of wx.ImageList.


DeleteAllPages()[source]

Deletes all the pages in the FlatNotebook.



DeletePage(page)[source]

Deletes the specified page, and the associated window.

Parameters:page – an integer specifying the new selected page.

Note

The call to this function generates the page changing events.



DoGetBestSize()[source]

Gets the size which best suits the window: for a control, it would be the minimal size which doesn’t truncate the control, for a panel - the same size as it would have after a call to Fit().

Note

Overridden from wx.PyPanel.



EnableTab(page, enabled=True)[source]

Enables or disables a tab.

Parameters:
  • page – an integer specifying the page index;
  • enabledTrue to enable a tab, False to disable it.


EnsureVisible(page)[source]

Ensures that a tab is visible.

Parameters:page – an integer specifying the page index.


GetAGWWindowStyleFlag()[source]

Returns the FlatNotebook window style.

See also

SetAGWWindowStyleFlag for a list of valid window styles.



GetActiveTabColour()[source]

Returns the active tab colour.



GetActiveTabTextColour()[source]

Get the active tab text colour.



GetBorderColour()[source]

Returns the border colour.



GetCurrentPage()[source]

Returns the currently selected notebook page or None if none is selected.



GetCustomPage()[source]

Returns a custom panel to show when there are no pages left in FlatNotebook.



GetEnabled(page)[source]

Returns whether a tab is enabled or not.

Parameters:page – an integer specifying the page index.


GetGradientColourBorder()[source]

Gets the tab border colour.



GetGradientColourFrom()[source]

Gets first gradient colour.



GetGradientColourTo()[source]

Gets second gradient colour.



GetImageList()[source]

Returns the associated image list.



GetNonActiveTabTextColour()[source]

Returns the non active tabs text colour.



GetPadding()[source]

Returns the amount of space around each page’s icon and label, in pixels.



GetPage(page)[source]

Returns the window at the given page position, or None.



GetPageBestSize()[source]

Return the page best size.



GetPageCount()[source]

Returns the number of pages in the FlatNotebook control.



GetPageImage(page)[source]

Returns the image index for the given page.

Parameters:page – an integer specifying the page index.


GetPageIndex(win)[source]

Returns the index at which the window is found.

Parameters:win – an instance of wx.Window.


GetPageShapeAngle(page_index)[source]

Returns the angle associated to a tab.

Parameters:page_index – the index of the tab for which we wish to get the shape angle.


GetPageText(page)[source]

Returns the string for the given page.

Parameters:page – an integer specifying the page index.


GetPageTextColour(page)[source]

Returns the tab text colour if it has been set previously, or None otherwise.

Parameters:page – an integer specifying the page index.


GetPreviousSelection()[source]

Returns the previous selection.



GetSelection()[source]

Returns the currently selected page, or -1 if none was selected.



GetTabArea()[source]

Returns the associated page.



GetTabAreaColour()[source]

Returns the area behind the tabs colour.



GetTileOrientation()[source]

Returns the orientation when on tiling mode. This method can return wx.VERTICAL when the panels are vertically stacked, wx.HORIZONTAL when they are horizontally stacked panels or None when there is no stacking and FlatNotebook behaves like a normal notebook.



HasAGWFlag(flag)[source]

Returns whether a flag is present in the FlatNotebook style.

Parameters:flag – one of the possible FlatNotebook window styles.

See also

SetAGWWindowStyleFlag for a list of possible window style flags.



HideTabs()[source]

Hides the tabs.



Init()[source]

Initializes all the class attributes.



InsertPage(indx, page, text, select=True, imageId=-1)[source]

Inserts a new page at the specified position.

Parameters:
  • indx – specifies the position of the new page;
  • page – specifies the new page;
  • text – specifies the text for the new page;
  • select – specifies whether the page should be selected;
  • imageId – specifies the optional image index for the new page.
Returns:

True if successful, False otherwise.



OnDropTarget(x, y, nTabPage, wnd_oldContainer)[source]

Handles the drop action from a drag and drop operation.

Parameters:
  • x – the x position of the drop action;
  • y – the y position of the drop action;
  • nTabPage – the index of the tab being dropped;
  • wnd_oldContainer – the FlatNotebook to which the dropped tab previously belonged to.


OnNavigationKey(event)[source]

Handles the wx.EVT_NAVIGATION_KEY event for FlatNotebook.

Parameters:event – a wx.NavigationKeyEvent event to be processed.


RemovePage(page)[source]

Deletes the specified page, without deleting the associated window.

Parameters:page – an integer specifying the page index.


SetAGWWindowStyleFlag(agwStyle)[source]

Sets the FlatNotebook window style flags.

Parameters:agwStyle – the AGW-specific window style. This can be a combination of the following bits:


Window Styles Hex Value Description
FNB_VC71 0x1 Use Visual Studio 2003 (VC7.1) style for tabs.
FNB_FANCY_TABS 0x2 Use fancy style - square tabs filled with gradient colouring.
FNB_TABS_BORDER_SIMPLE 0x4 Draw thin border around the page.
FNB_NO_X_BUTTON 0x8 Do not display the ‘X’ button.
FNB_NO_NAV_BUTTONS 0x10 Do not display the right/left arrows.
FNB_MOUSE_MIDDLE_CLOSES_TABS 0x20 Use the mouse middle button for cloing tabs.
FNB_BOTTOM 0x40 Place tabs at bottom - the default is to place them at top.
FNB_NODRAG 0x80 Disable dragging of tabs.
FNB_VC8 0x100 Use Visual Studio 2005 (VC8) style for tabs.
FNB_X_ON_TAB 0x200 Place ‘X’ close button on the active tab.
FNB_BACKGROUND_GRADIENT 0x400 Use gradients to paint the tabs background.
FNB_COLOURFUL_TABS 0x800 Use colourful tabs (VC8 style only).
FNB_DCLICK_CLOSES_TABS 0x1000 Style to close tab using double click.
FNB_SMART_TABS 0x2000 Use Smart Tabbing, like Alt + Tab on Windows.
FNB_DROPDOWN_TABS_LIST 0x4000 Use a dropdown menu on the left in place of the arrows.
FNB_ALLOW_FOREIGN_DND 0x8000 Allows drag ‘n’ drop operations between different FlatNotebook.
FNB_HIDE_ON_SINGLE_TAB 0x10000 Hides the Page Container when there is one or fewer tabs.
FNB_DEFAULT_STYLE 0x10020 FlatNotebook default style.
FNB_FF2 0x20000 Use Firefox 2 style for tabs.
FNB_NO_TAB_FOCUS 0x40000 Does not allow tabs to have focus.
FNB_RIBBON_TABS 0x80000 Use the Ribbon Tabs style.
FNB_HIDE_TABS 0x100000 Hides the Page Container allowing only keyboard navigation
FNB_NAV_BUTTONS_WHEN_NEEDED 0x200000 Hides the navigation left/right arrows if all tabs fit


SetActiveTabColour(colour)[source]

Sets the active tab colour.

Parameters:colour – a valid wx.Colour object or any typemap supported by wxWidgets/wxPython to generate a colour (i.e., a hex string, a colour name, a 3 or 4 integer tuple).


SetActiveTabTextColour(textColour)[source]

Sets the text colour for the active tab.

Parameters:textColour – a valid wx.Colour object or any typemap supported by wxWidgets/wxPython to generate a colour (i.e., a hex string, a colour name, a 3 or 4 integer tuple).



SetAllPagesShapeAngle(angle)[source]

Sets the angle associated to all the tab.

Parameters:angle – the new shape angle for the tab (must be less than 15 degrees).


SetCustomPage(panel)[source]

Sets a custom panel to show when there are no pages left in FlatNotebook.

Parameters:panel – any subclass of wx.Window will do, as long as it is suitable to be used as a notebook page. Examples include wx.Panel, wx.ScrolledWindow, and so on.



SetGradientColourBorder(border)[source]

Sets the tab border colour.

Parameters:border – the border colour, an instance of wx.Colour.



SetGradientColourFrom(fr)[source]

Sets the starting colour for the gradient.

Parameters:fr – the first gradient colour, an instance of wx.Colour.



SetGradientColourTo(to)[source]

Sets the ending colour for the gradient.

Parameters:to – the second gradient colour, an instance of wx.Colour;



SetGradientColours(fr, to, border)[source]

Sets the gradient colours for the tab.

Parameters:
  • fr – the first gradient colour, an instance of wx.Colour;

  • to – the second gradient colour, an instance of wx.Colour;

  • border – the border colour, an instance of wx.Colour.



SetImageList(imageList)[source]

Sets the image list for the page control.

Parameters:imageList – an instance of wx.ImageList.



SetNavigatorIcon(bmp)[source]

Set the icon used by the TabNavigatorWindow.

Parameters:bmp – a valid wx.Bitmap object.


SetNonActiveTabTextColour(colour)[source]

Sets the non active tabs text colour.

Parameters:colour – a valid wx.Colour object or any typemap supported by wxWidgets/wxPython to generate a colour (i.e., a hex string, a colour name, a 3 or 4 integer tuple).



SetPadding(padding)[source]

Sets the amount of space around each page’s icon and label, in pixels.

Parameters:padding – the amount of space around each page’s icon and label, in pixels.

Note

Only the horizontal padding is considered.



SetPageImage(page, image)[source]

Sets the image index for the given page.

Parameters:
  • page – an integer specifying the page index;
  • image – an index into the image list which was set with SetImageList.


SetPageShapeAngle(page_index, angle)[source]

Sets the angle associated to a tab.

Parameters:
  • page_index – the index of the tab for which we wish to get the shape angle;
  • angle – the new shape angle for the tab (must be less than 15 degrees).


SetPageText(page, text)[source]

Sets the text for the given page.

Parameters:
  • page – an integer specifying the page index;
  • text – the new tab label.


SetPageTextColour(page, colour)[source]

Sets the tab text colour individually.

Parameters:
  • page – an integer specifying the page index;
  • colour – a valid wx.Colour object or any typemap supported by wxWidgets/wxPython to generate a colour (i.e., a hex string, a colour name, a 3 or 4 integer tuple). You can pass None or wx.NullColour to return to the default page text colour.



SetRightClickMenu(menu)[source]

Sets the popup menu associated to a right click on a tab.

Parameters:menu – an instance of wx.Menu.


SetSelection(page)[source]

Sets the selection for the given page.

Parameters:page – an integer specifying the new selected page.

Note

The call to this function does not generate the page changing events.



SetTabAreaColour(colour)[source]

Sets the area behind the tabs colour.

Parameters:colour – a valid wx.Colour object or any typemap supported by wxWidgets/wxPython to generate a colour (i.e., a hex string, a colour name, a 3 or 4 integer tuple).



ShowCustomPage(show=True)[source]

Hides the custom panel which is shown when there are no pages left in FlatNotebook.



ShowTabs()[source]

Shows the tabs if hidden previously.



Tile(orient=None)[source]

Shows pages in column/row mode (one panel after the other in columns/rows).

Parameters:orient – this parameter represents the orientation of the stacked panels. Pass wx.VERTICAL to get vertically stacked panels, wx.HORIZONTAL to get horizontally stacked panels or None to return to the default FlatNotebook behaviour with tabs.
Tree

Table Of Contents

Previous topic

FNBRendererVC8

Next topic

FlatNotebookCompatible