The FlatNotebook
is a full implementation of the Notebook
, and designed to be
a drop-in replacement for Notebook
. The API functions are similar so one can
expect the function to behave in the same way.
wx.lib.agw.flatnotebook.FlatNotebookCompatible
Default class constructor. |
|
Adds a page to the |
|
Cycles through the tabs. |
|
Assigns the image list for the page control. |
|
Deletes all the pages in the |
|
Deletes the specified page, and the associated window. |
|
Gets the size which best suits the window: for a control, it would be the |
|
Enables or disables a tab. |
|
Ensures that a tab is visible. |
|
Returns the active tab colour. |
|
Get the active tab text colour. |
|
Returns the |
|
Returns the border colour. |
|
Returns the currently selected notebook page or |
|
Returns a custom panel to show when there are no pages left in |
|
Returns whether a tab is enabled or not. |
|
Gets the tab border colour. |
|
Gets first gradient colour. |
|
Gets second gradient colour. |
|
Returns the associated image list. |
|
Returns the non active tabs text colour. |
|
Returns the amount of space around each page’s icon and label, in pixels. |
|
Returns the window at the given page position, or |
|
Return the page best size. |
|
Returns the number of pages in the |
|
Returns the image index for the given page. |
|
Returns the index at which the window is found. |
|
Returns the angle associated to a tab. |
|
Returns the string for the given page. |
|
Returns the tab text colour if it has been set previously, or |
|
Returns the previous selection. |
|
Returns the currently selected page, or -1 if none was selected. |
|
Returns the associated page. |
|
Returns the area behind the tabs colour. |
|
Returns the orientation when on tiling mode. This method can return |
|
Returns whether a flag is present in the |
|
Hides the tabs. |
|
Initializes all the class attributes. |
|
Inserts a new page at the specified position. |
|
Handles the drop action from a drag and drop operation. |
|
Handles the |
|
Deletes the specified page, without deleting the associated window. |
|
Sets the active tab colour. |
|
Sets the text colour for the active tab. |
|
Sets the |
|
Sets the angle associated to all the tab. |
|
Sets a custom panel to show when there are no pages left in |
|
Sets the tab border colour. |
|
Sets the starting colour for the gradient. |
|
Sets the gradient colours for the tab. |
|
Sets the ending colour for the gradient. |
|
Sets the image list for the page control. |
|
Set the icon used by the |
|
Sets the non active tabs text colour. |
|
Sets the amount of space around each page’s icon and label, in pixels. |
|
Sets the image index for the given page. |
|
Sets the angle associated to a tab. |
|
Sets the text for the given page. |
|
Sets the tab text colour individually. |
|
Sets the popup menu associated to a right click on a tab. |
|
Sets the selection for the given page. |
|
Sets the area behind the tabs colour. |
|
Hides the custom panel which is shown when there are no pages left in |
|
Shows the tabs if hidden previously. |
|
Shows pages in column/row mode (one panel after the other in columns/rows). |
FlatNotebook
(wx.Panel)¶The FlatNotebook
is a full implementation of the Notebook
, and designed to be
a drop-in replacement for Notebook
. The API functions are similar so one can
expect the function to behave in the same way.
__init__
(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=0, name="FlatNotebook")¶Default class constructor.
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 Panel
window style;
agwStyle –
the AGW-specific window style. This can be a combination of the following bits:
Window Styles |
Hex Value |
Description |
---|---|---|
|
0x1 |
Use Visual Studio 2003 (VC7.1) style for tabs. |
|
0x2 |
Use fancy style - square tabs filled with gradient colouring. |
|
0x4 |
Draw thin border around the page. |
|
0x8 |
Do not display the ‘X’ button. |
|
0x10 |
Do not display the right/left arrows. |
|
0x20 |
Use the mouse middle button for cloing tabs. |
|
0x40 |
Place tabs at bottom - the default is to place them at top. |
|
0x80 |
Disable dragging of tabs. |
|
0x100 |
Use Visual Studio 2005 (VC8) style for tabs. |
|
0x200 |
Place ‘X’ close button on the active tab. |
|
0x400 |
Use gradients to paint the tabs background. |
|
0x800 |
Use colourful tabs (VC8 style only). |
|
0x1000 |
Style to close tab using double click. |
|
0x2000 |
Use Smart Tabbing, like |
|
0x4000 |
Use a dropdown menu on the left in place of the arrows. |
|
0x8000 |
Allows drag ‘n’ drop operations between different |
|
0x10000 |
Hides the Page Container when there is one or fewer tabs. |
|
0x10020 |
|
|
0x20000 |
Use Firefox 2 style for tabs. |
|
0x40000 |
Does not allow tabs to have focus. |
|
0x80000 |
Use the Ribbon Tabs style. |
|
0x100000 |
Hides the Page Container allowing only keyboard navigation |
|
0x200000 |
Hides the navigation left/right arrows if all tabs fit |
name – the window name.
AddPage
(self, page, text, select=False, imageId=-1)¶Adds a page to the FlatNotebook
.
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.
True
if successful, False
otherwise.
AdvanceSelection
(self, forward=True)¶Cycles through the tabs.
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
(self, imageList)¶Assigns the image list for the page control.
imageList – an instance of wx.ImageList
.
DeleteAllPages
(self)¶Deletes all the pages in the FlatNotebook
.
DeletePage
(self, page)¶Deletes the specified page, and the associated window.
page – an integer specifying the new selected page.
Note
The call to this function generates the page changing events.
DoGetBestSize
(self)¶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 Panel
.
EnableTab
(self, page, enabled=True)¶Enables or disables a tab.
page – an integer specifying the page index;
enabled – True
to enable a tab, False
to disable it.
EnsureVisible
(self, page)¶Ensures that a tab is visible.
page – an integer specifying the page index.
GetActiveTabColour
(self)¶Returns the active tab colour.
GetActiveTabTextColour
(self)¶Get the active tab text colour.
GetAGWWindowStyleFlag
(self)¶Returns the FlatNotebook
window style.
See also
SetAGWWindowStyleFlag
for a list of valid window styles.
GetBorderColour
(self)¶Returns the border colour.
GetCurrentPage
(self)¶Returns the currently selected notebook page or None
if none is selected.
GetCustomPage
(self)¶Returns a custom panel to show when there are no pages left in FlatNotebook
.
GetEnabled
(self, page)¶Returns whether a tab is enabled or not.
page – an integer specifying the page index.
GetGradientColourBorder
(self)¶Gets the tab border colour.
GetGradientColourFrom
(self)¶Gets first gradient colour.
GetGradientColourTo
(self)¶Gets second gradient colour.
GetImageList
(self)¶Returns the associated image list.
GetNonActiveTabTextColour
(self)¶Returns the non active tabs text colour.
GetPadding
(self)¶Returns the amount of space around each page’s icon and label, in pixels.
GetPage
(self, page)¶Returns the window at the given page position, or None
.
GetPageBestSize
(self)¶Return the page best size.
GetPageCount
(self)¶Returns the number of pages in the FlatNotebook
control.
GetPageImage
(self, page)¶Returns the image index for the given page.
page – an integer specifying the page index.
GetPageIndex
(self, win)¶Returns the index at which the window is found.
win – an instance of wx.Window
.
GetPageShapeAngle
(self, page_index)¶Returns the angle associated to a tab.
page_index – the index of the tab for which we wish to get the shape angle.
GetPageText
(self, page)¶Returns the string for the given page.
page – an integer specifying the page index.
GetPageTextColour
(self, page)¶Returns the tab text colour if it has been set previously, or None
otherwise.
page – an integer specifying the page index.
GetPreviousSelection
(self)¶Returns the previous selection.
GetSelection
(self)¶Returns the currently selected page, or -1 if none was selected.
GetTabArea
(self)¶Returns the associated page.
GetTabAreaColour
(self)¶Returns the area behind the tabs colour.
GetTileOrientation
(self)¶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
(self, flag)¶Returns whether a flag is present in the FlatNotebook
style.
flag – one of the possible FlatNotebook
window styles.
See also
SetAGWWindowStyleFlag
for a list of possible window style flags.
HideTabs
(self)¶Hides the tabs.
Init
(self)¶Initializes all the class attributes.
InsertPage
(self, indx, page, text, select=True, imageId=-1)¶Inserts a new page at the specified position.
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.
True
if successful, False
otherwise.
OnDropTarget
(self, x, y, nTabPage, wnd_oldContainer)¶Handles the drop action from a drag and drop operation.
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.
Handles the wx.EVT_NAVIGATION_KEY
event for FlatNotebook
.
event – a NavigationKeyEvent
event to be processed.
RemovePage
(self, page)¶Deletes the specified page, without deleting the associated window.
page – an integer specifying the page index.
SetActiveTabColour
(self, colour)¶Sets the active tab colour.
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
(self, textColour)¶Sets the text colour for the active tab.
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).
SetAGWWindowStyleFlag
(self, agwStyle)¶Sets the FlatNotebook
window style flags.
agwStyle –
the AGW-specific window style. This can be a combination of the following bits:
Window Styles |
Hex Value |
Description |
---|---|---|
|
0x1 |
Use Visual Studio 2003 (VC7.1) style for tabs. |
|
0x2 |
Use fancy style - square tabs filled with gradient colouring. |
|
0x4 |
Draw thin border around the page. |
|
0x8 |
Do not display the ‘X’ button. |
|
0x10 |
Do not display the right/left arrows. |
|
0x20 |
Use the mouse middle button for cloing tabs. |
|
0x40 |
Place tabs at bottom - the default is to place them at top. |
|
0x80 |
Disable dragging of tabs. |
|
0x100 |
Use Visual Studio 2005 (VC8) style for tabs. |
|
0x200 |
Place ‘X’ close button on the active tab. |
|
0x400 |
Use gradients to paint the tabs background. |
|
0x800 |
Use colourful tabs (VC8 style only). |
|
0x1000 |
Style to close tab using double click. |
|
0x2000 |
Use Smart Tabbing, like |
|
0x4000 |
Use a dropdown menu on the left in place of the arrows. |
|
0x8000 |
Allows drag ‘n’ drop operations between different |
|
0x10000 |
Hides the Page Container when there is one or fewer tabs. |
|
0x10020 |
|
|
0x20000 |
Use Firefox 2 style for tabs. |
|
0x40000 |
Does not allow tabs to have focus. |
|
0x80000 |
Use the Ribbon Tabs style. |
|
0x100000 |
Hides the Page Container allowing only keyboard navigation |
|
0x200000 |
Hides the navigation left/right arrows if all tabs fit |
SetAllPagesShapeAngle
(self, angle)¶Sets the angle associated to all the tab.
angle – the new shape angle for the tab (must be less than 15 degrees).
SetCustomPage
(self, panel)¶Sets a custom panel to show when there are no pages left in FlatNotebook
.
panel – any subclass of wx.Window
will do, as long as it is suitable
to be used as a notebook page. Examples include Panel
, ScrolledWindow
,
and so on.
SetGradientColourBorder
(self, border)¶Sets the tab border colour.
border – the border colour, an instance of wx.Colour
.
SetGradientColourFrom
(self, fr)¶Sets the starting colour for the gradient.
fr – the first gradient colour, an instance of wx.Colour
.
SetGradientColours
(self, fr, to, border)¶Sets the gradient colours for the tab.
SetGradientColourTo
(self, to)¶Sets the ending colour for the gradient.
to – the second gradient colour, an instance of wx.Colour
;
SetImageList
(self, imageList)¶Sets the image list for the page control.
imageList – an instance of wx.ImageList
.
Set the icon used by the TabNavigatorWindow
.
bmp – a valid wx.Bitmap
object.
SetNonActiveTabTextColour
(self, colour)¶Sets the non active tabs text colour.
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
(self, padding)¶Sets the amount of space around each page’s icon and label, in pixels.
padding – the amount of space around each page’s icon and label, in pixels.
Note
Only the horizontal padding is considered.
SetPageImage
(self, page, image)¶Sets the image index for the given page.
page – an integer specifying the page index;
image – an index into the image list which was set with SetImageList
.
SetPageShapeAngle
(self, page_index, angle)¶Sets the angle associated to a tab.
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
(self, page, text)¶Sets the text for the given page.
page – an integer specifying the page index;
text – the new tab label.
SetPageTextColour
(self, page, colour)¶Sets the tab text colour individually.
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 NullColour
to return to the default page text colour.
SetRightClickMenu
(self, menu)¶Sets the popup menu associated to a right click on a tab.
menu – an instance of wx.Menu
.
SetSelection
(self, page)¶Sets the selection for the given page.
page – an integer specifying the new selected page.
Note
The call to this function does not generate the page changing events.
SetTabAreaColour
(self, colour)¶Sets the area behind the tabs colour.
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
(self, show=True)¶Hides the custom panel which is shown when there are no pages left in FlatNotebook
.
ShowTabs
(self)¶Shows the tabs if hidden previously.
Tile
(self, orient=None)¶Shows pages in column/row mode (one panel after the other in columns/rows).
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.