Phoenix Logo

phoenix_title wx.lib.agw.flatnotebook.PageContainer

This class acts as a container for the pages you add to FlatNotebook.


class_hierarchy Class Hierarchy

Inheritance diagram for class PageContainer:


super_classes Known Superclasses

wx.Panel


method_summary Methods Summary

__init__ Default class constructor.
AddPage Adds a page to the PageContainer.
AdvanceSelection Cycles through the tabs.
AssignImageList Assigns the image list for the PageContainer.
CanFitToScreen Returns wheter a tab can fit in the left space in the screen or not.
ClearAGWFlag Deletes a flag from the FlatNotebook style.
DeleteAllPages Deletes all the pages in the PageContainer.
DeletePage Delete the specified page from PageContainer.
DoDeletePage Does the actual page deletion.
DoSetSelection Does the actual selection of a page.
DrawDragHint Draws small arrow at the place that the tab will be placed.
EnableTab Enables or disables a tab.
FireEvent Fires the EVT_FLATNOTEBOOK_PAGE_CHANGING and EVT_FLATNOTEBOOK_PAGE_CHANGED
GetAGWWindowStyleFlag Returns the FlatNotebook window style.
GetEnabled Returns whether a tab is enabled or not.
GetImageList Returns the image list for the page control.
GetLastVisibleTab Returns the last visible tab in the tab area.
GetNumOfVisibleTabs Returns the number of visible tabs.
GetNumTabsCanScrollLeft Returns the number of tabs than can be scrolled left.
GetPageCount Returns the number of tabs in the FlatNotebook control.
GetPageImage Returns the image index associated to a page.
GetPageText Returns the tab caption of the page.
GetPageTextColour Returns the tab text colour if it has been set previously, or None otherwise.
GetSelection Returns the current selected page.
GetSingleLineBorderColour Returns the colour for the single line border.
HasAGWFlag Returns whether a flag is present in the FlatNotebook style.
HitTest HitTest method for PageContainer.
InsertPage Inserts a new page at the specified position.
IsDefaultTabs Returns whether a tab has a default style.
IsMouseHovering Returns whether or not the mouse is hovering over this page’s tab
IsTabVisible Returns whether a tab is visible or not.
MoveTabPage Moves a tab inside the same FlatNotebook.
OnDropTarget Handles the drop action from a drag and drop operation.
OnEraseBackground Handles the wx.EVT_ERASE_BACKGROUND event for PageContainer.
OnKeyDown Handles the wx.EVT_KEY_DOWN event for PageContainer.
OnKillFocus Handles the wx.EVT_KILL_FOCUS event for PageContainer.
OnLeftDClick Handles the wx.EVT_LEFT_DCLICK event for PageContainer.
OnLeftDown Handles the wx.EVT_LEFT_DOWN event for PageContainer.
OnLeftUp Handles the wx.EVT_LEFT_UP event for PageContainer.
OnMiddleDown Handles the wx.EVT_MIDDLE_DOWN event for PageContainer.
OnMouseEnterWindow Handles the wx.EVT_ENTER_WINDOW event for PageContainer.
OnMouseLeave Handles the wx.EVT_LEAVE_WINDOW event for PageContainer.
OnMouseMove Handles the wx.EVT_MOTION event for PageContainer.
OnMouseWheel Handles the wx.EVT_MOUSEWHEEL event for PageContainer.
OnPaint Handles the wx.EVT_PAINT event for PageContainer.
OnRightDown Handles the wx.EVT_RIGHT_DOWN event for PageContainer.
OnSetFocus Handles the wx.EVT_SET_FOCUS event for PageContainer.
OnSize Handles the wx.EVT_SIZE event for PageContainer.
OnTabMenuSelection Handles the wx.EVT_MENU event for PageContainer.
PopupTabsMenu Pops up the menu activated with the drop down arrow in the navigation area.
RotateLeft Scrolls tabs to the left by bulk of 5 tabs.
RotateRight Scrolls tabs to the right by bulk of 5 tabs.
SetAGWWindowStyleFlag Sets the FlatNotebook window style.
SetFocusedPage Sets/Unsets the focus on the appropriate page.
SetImageList Sets the image list for the PageContainer.
SetPageImage Sets the image index for the given page.
SetPageText Sets the tab caption of the page.
SetPageTextColour Sets the tab text colour individually.
SetSelection Sets the selected page.
ShowTabTooltip Shows a tab tooltip.
TabHasImage Returns whether a tab has an associated image index or not.

api Class API



class PageContainer(wx.Panel)

This class acts as a container for the pages you add to FlatNotebook.


Methods



__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0)

Default class constructor.

Used internally, do not call it in your code!

Parameters:
  • parent – the PageContainer 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.


AddPage(self, caption, selected=False, imgindex=-1)

Adds a page to the PageContainer.

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.


AdvanceSelection(self, forward=True)

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(self, imglist)

Assigns the image list for the PageContainer.

Parameters:imageList – an instance of wx.ImageList.


CanFitToScreen(self, page)

Returns wheter a tab can fit in the left space in the screen or not.

Parameters:page – an integer specifying the page index.


ClearAGWFlag(self, flag)

Deletes a flag from the FlatNotebook style.

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

See also

FlatNotebook.SetAGWWindowStyleFlag() for a list of possible window style flags.



DeleteAllPages(self)

Deletes all the pages in the PageContainer.



DeletePage(self, page)

Delete the specified page from PageContainer.

Parameters:page – an integer specifying the page index.


DoDeletePage(self, page)

Does the actual page deletion.

Parameters:page – an integer specifying the page index.


DoSetSelection(self, page)

Does the actual selection of a page.

Parameters:page – an integer specifying the page index.


DrawDragHint(self)

Draws small arrow at the place that the tab will be placed.



EnableTab(self, page, enabled=True)

Enables or disables a tab.

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


FireEvent(self, selection)

Fires the EVT_FLATNOTEBOOK_PAGE_CHANGING and EVT_FLATNOTEBOOK_PAGE_CHANGED events called from other methods (from menu selection or Smart Tabbing).

This is an utility function.

Parameters:selection – the new selection inside FlatNotebook.


GetAGWWindowStyleFlag(self)

Returns the FlatNotebook window style.

See also

The FlatNotebook.__init__() method for the agwStyle parameter description.



GetEnabled(self, page)

Returns whether a tab is enabled or not.

Parameters:page – an integer specifying the page index.


GetImageList(self)

Returns the image list for the page control.



GetLastVisibleTab(self)

Returns the last visible tab in the tab area.



GetNumOfVisibleTabs(self)

Returns the number of visible tabs.



GetNumTabsCanScrollLeft(self)

Returns the number of tabs than can be scrolled left.



GetPageCount(self)

Returns the number of tabs in the FlatNotebook control.



GetPageImage(self, page)

Returns the image index associated to a page.

Parameters:page – an integer specifying the page index.


GetPageText(self, page)

Returns the tab caption of the page.

Parameters:page – an integer specifying the page index.


GetPageTextColour(self, page)

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

Parameters:page – an integer specifying the page index.


GetSelection(self)

Returns the current selected page.



GetSingleLineBorderColour(self)

Returns the colour for the single line border.



HasAGWFlag(self, flag)

Returns whether a flag is present in the FlatNotebook style.

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

See also

FlatNotebook.SetAGWWindowStyleFlag() for a list of possible window style flags.



HitTest(self, pt)

HitTest method for PageContainer.

Parameters:pt – an instance of wx.Point, to test for hits.
Returns:The hit test flag (if any) and the hit page index (if any). The return value can be one of the following bits:
HitTest Flag Value Description
FNB_NOWHERE 0 Indicates mouse coordinates not on any tab of the notebook
FNB_TAB 1 Indicates mouse coordinates inside a tab
FNB_X 2 Indicates mouse coordinates inside the ‘X’ button region
FNB_TAB_X 3 Indicates mouse coordinates inside the ‘X’ region in a tab
FNB_LEFT_ARROW 4 Indicates mouse coordinates inside the left arrow region
FNB_RIGHT_ARROW 5 Indicates mouse coordinates inside the right arrow region
FNB_DROP_DOWN_ARROW 6 Indicates mouse coordinates inside the drop down arrow region


InsertPage(self, indx, text, selected=True, imgindex=-1)

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.


IsDefaultTabs(self)

Returns whether a tab has a default style.



IsMouseHovering(self, page)

Returns whether or not the mouse is hovering over this page’s tab

Parameters:page – an integer specifying the page index.


IsTabVisible(self, page)

Returns whether a tab is visible or not.

Parameters:page – an integer specifying the page index.


MoveTabPage(self, nMove, nMoveTo)

Moves a tab inside the same FlatNotebook.

Parameters:
  • nMove – the start index of the moved tab;
  • nMoveTo – the destination index of the moved tab.


OnDropTarget(self, x, y, nTabPage, wnd_oldContainer)

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.


OnEraseBackground(self, event)

Handles the wx.EVT_ERASE_BACKGROUND event for PageContainer.

Parameters:event – a EraseEvent event to be processed.

Note

This method is intentionally empty to reduce flicker.



OnKeyDown(self, event)

Handles the wx.EVT_KEY_DOWN event for PageContainer.

Parameters:event – a KeyEvent event to be processed.

Note

When the PageContainer has the focus tabs can be changed with the left/right arrow keys.



OnKillFocus(self, event)

Handles the wx.EVT_KILL_FOCUS event for PageContainer.

Parameters:event – a FocusEvent event to be processed.


OnLeftDClick(self, event)

Handles the wx.EVT_LEFT_DCLICK event for PageContainer.

Parameters:event – a MouseEvent event to be processed.


OnLeftDown(self, event)

Handles the wx.EVT_LEFT_DOWN event for PageContainer.

Parameters:event – a MouseEvent event to be processed.


OnLeftUp(self, event)

Handles the wx.EVT_LEFT_UP event for PageContainer.

Parameters:event – a MouseEvent event to be processed.


OnMiddleDown(self, event)

Handles the wx.EVT_MIDDLE_DOWN event for PageContainer.

Parameters:event – a MouseEvent event to be processed.


OnMouseEnterWindow(self, event)

Handles the wx.EVT_ENTER_WINDOW event for PageContainer.

Parameters:event – a MouseEvent event to be processed.


OnMouseLeave(self, event)

Handles the wx.EVT_LEAVE_WINDOW event for PageContainer.

Parameters:event – a MouseEvent event to be processed.


OnMouseMove(self, event)

Handles the wx.EVT_MOTION event for PageContainer.

Parameters:event – a MouseEvent event to be processed.


OnMouseWheel(self, event)

Handles the wx.EVT_MOUSEWHEEL event for PageContainer.

Parameters:event – a MouseEvent event to be processed.


OnPaint(self, event)

Handles the wx.EVT_PAINT event for PageContainer.

Parameters:event – a PaintEvent event to be processed.


OnRightDown(self, event)

Handles the wx.EVT_RIGHT_DOWN event for PageContainer.

Parameters:event – a MouseEvent event to be processed.


OnSetFocus(self, event)

Handles the wx.EVT_SET_FOCUS event for PageContainer.

Parameters:event – a FocusEvent event to be processed.


OnSize(self, event)

Handles the wx.EVT_SIZE event for PageContainer.

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


OnTabMenuSelection(self, event)

Handles the wx.EVT_MENU event for PageContainer.

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


PopupTabsMenu(self)

Pops up the menu activated with the drop down arrow in the navigation area.



RotateLeft(self)

Scrolls tabs to the left by bulk of 5 tabs.



RotateRight(self)

Scrolls tabs to the right by bulk of 5 tabs.



SetAGWWindowStyleFlag(self, agwStyle)

Sets the FlatNotebook window style.

Parameters:agwStyle – the new FlatNotebook window style.

See also

The FlatNotebook.__init__() method for the agwStyle parameter description.



SetFocusedPage(self, pageIndex=-1)

Sets/Unsets the focus on the appropriate page.

Parameters:pageIndex – an integer specifying the page index. If pageIndex is defaulted to -1, we have lost focus and no focus indicator is drawn.


SetImageList(self, imglist)

Sets the image list for the PageContainer.

Parameters:imageList – an instance of wx.ImageList.


SetPageImage(self, page, image)

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.


SetPageText(self, page, text)

Sets the tab caption of the page.

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


SetPageTextColour(self, page, colour)

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 NullColour to return to the default page text colour.


SetSelection(self, page)

Sets the selected page.

Parameters:page – an integer specifying the page index.


ShowTabTooltip(self, tabIdx)

Shows a tab tooltip.

Parameters:tabIdx – an integer specifying the page index.


TabHasImage(self, tabIdx)

Returns whether a tab has an associated image index or not.

Parameters:tabIdx – an integer specifying the page index.