wx.Treebook

Inheritance diagram for wx.Treebook:



Description

This class is an extension of the wx.Notebook class that allows a tree structured set of pages to be shown in a control. A classic example is a netscape preferences dialog that shows a tree of preference sections on the left and select section page on the right.

To use the class simply create it and populate with pages using InsertPage, InsertSubPage, AddPage, AddSubPage .

If your tree is no more than 1 level in depth then you could simply use AddPage and AddSubPage to sequentially populate your tree by adding at every step a page or a subpage to the end of the tree.

Event Handling

Event Name Description
wx.EVT_TREEBOOK_PAGE_CHANGED(id, func) The page selection was changed. Processes a wx.wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED event.
wx.EVT_TREEBOOK_PAGE_CHANGING(id, func) The page selection is about to be changed. Processes a wx.wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING event. This event can be vetoed.
wx.EVT_TREEBOOK_NODE_COLLAPSED(id, func) The page node is going to be collapsed. Processes a wx.wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED event.
wx.EVT_TREEBOOK_NODE_EXPANDED(id, func) The page node is going to be expanded. Processes a wx.wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED event.

Properties Summary

Class API

Methods

__init__(parent, id, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.BK_DEFAULT, name="")

Creates an empty wx.Treebook control.

Parameters:


Returns:

wx.Treebook


AddSubPage(page, text, bSelect=False, imageId=wx.NOT_FOUND)

Adds a new child-page to the last top-level page.

None could be specified for page to create an empty page.

Parameters:

  • page (wx.Window)
  • text (string)
  • bSelect (bool)
  • imageId (int)

Returns:

bool


CollapseNode(pageId)

Shortcut for ExpandNode (pageId, False).

Parameters:

  • pageId (long)

Returns:

bool


ExpandNode(pageId, expand=True)

Expands (collapses) the pageId node. Returns the previous state.

May generate page changing events (if selected page is under the collapsed branch, then its parent is autoselected).

Parameters:

  • pageId (long)
  • expand (bool)

Returns:

bool


GetPageParent(page)

Returns the parent page of the given one or wx.NOT_FOUND if this is a top-level page.

Parameters:

  • page (long)

Returns:

int


GetTreeCtrl()
No docstrings found for this method.

InsertSubPage(pagePos, page, text, bSelect=False, imageId=wx.NOT_FOUND)

Inserts a sub page under the specified page.

None could be specified for page to create an empty page.

Parameters:

  • pagePos (long)
  • page (wx.Window)
  • text (string)
  • bSelect (bool)
  • imageId (int)

Returns:

bool


IsNodeExpanded(pageId)

Gets the pageId page state – whether it is expanded or collapsed

Parameters:

  • pageId (long)

Returns:

bool


Properties

TreeCtrl
See GetTreeCtrl