wx.BookCtrlBase

A book control is a convenient way of displaying multiple pages of information, displayed one page at a time.

wxWidgets has five variants of this control:

This abstract class is the parent of all these book controls, and provides their basic interface. This is a pure virtual class so you cannot allocate it directly.

 

 Class Hierarchy

 Inheritance diagram for class BookCtrlBase:

 

 Known Subclasses

wx.aui.AuiNotebookwx.Choicebookwx.Listbookwx.NotebookSimplebook , wx.Toolbookwx.Treebook

 

 Methods Summary

__init__ Default constructor.
AddPage Adds a new page.
AdvanceSelection Cycles through the tabs.
ChangeSelection Changes the selection to the given page, returning the previous selection.
Create Constructs the book control with the given parameters.
DeleteAllPages Deletes all pages.
DeletePage Deletes the specified page, and the associated window.
FindPage Returns the index of the specified tab window or NOT_FOUND if not found.
GetCurrentPage Returns the currently selected page or None.
GetPage Returns the window at the given page position.
GetPageCount Returns the number of pages in the control.
GetPageImage Returns the image index for the given page.
GetPageText Returns the string for the given page.
GetSelection Returns the currently selected page, or NOT_FOUND if none was selected.
HitTest Returns the index of the tab at the specified position or NOT_FOUND if none.
InsertPage Inserts a new page at the specified position.
RemovePage Deletes the specified page, without deleting the associated window.
SetPageImage Sets the image index for the given page.
SetPageSize Sets the width and height of the pages.
SetPageText Sets the text for the given page.
SetSelection Sets the selection to the given page, returning the previous selection.
 

 Class API


class wx.BookCtrlBase(ControlWithImages)

Possible constructors:

BookCtrlBase()

BookCtrlBase(parent, winid, pos=DefaultPosition, size=DefaultSize,
style=0, name="")

A book control is a convenient way of displaying multiple pages of information, displayed one page at a time.

Methods


__init__(self*args**kw)

 Overloaded Implementations:


__init__ (self)

Default constructor.


__init__ (self, parent, winid, pos=DefaultPosition, size=DefaultSize, style=0, name=””)

Constructs the book control with the given parameters.

See Create for two-step construction.

Parameters:
  • parent (wx.Window) –
  • winid (wx.WindowID) –
  • pos (wx.Point) –
  • size (wx.Size) –
  • style (long) –
  • name (string) –


AddPage(selfpagetextselect=FalseimageId=NO_IMAGE)

Adds a new page.

The page must have the book control itself as the parent and must not have been added to this control previously.

The call to this function may generate the page changing events.

Parameters:
  • page (wx.Window) – Specifies the new page.
  • text (string) – Specifies the text for the new page.
  • select (bool) – Specifies whether the page should be selected.
  • imageId (int) – Specifies the optional image index for the new page.
Return type:

bool

Returns:

True if successful, False otherwise.

Note

Do not delete the page, it will be deleted by the book control.

See also

InsertPage


AdvanceSelection(selfforward=True)

Cycles through the tabs.

The call to this function generates the page changing events.

Parameters: forward (bool) –


ChangeSelection(selfpage)

Changes the selection to the given page, returning the previous selection.

This function behaves as SetSelection but does not generate the page changing events.

See User Generated Events vs Programmatically Generated Events for more information.

Parameters: page (int) –
Return type: int


Create(selfparentwinidpos=DefaultPositionsize=DefaultSizestyle=0name="")

Constructs the book control with the given parameters.

Parameters:
  • parent (wx.Window) –
  • winid (wx.WindowID) –
  • pos (wx.Point) –
  • size (wx.Size) –
  • style (long) –
  • name (string) –
Return type:

bool


DeleteAllPages(self)

Deletes all pages.

Return type: bool


DeletePage(selfpage)

Deletes the specified page, and the associated window.

The call to this function generates the page changing events.

Parameters: page (int) –
Return type: bool


FindPage(selfpage)

Returns the index of the specified tab window or NOT_FOUND if not found.

Parameters: page (wx.Window) – One of the control pages.
Return type: int
Returns: The zero-based tab index or NOT_FOUND if not found.

New in version 2.9.5.


GetCurrentPage(self)

Returns the currently selected page or None.

Return type: wx.Window


GetPage(selfpage)

Returns the window at the given page position.

Parameters: page (int) –
Return type: wx.Window


GetPageCount(self)

Returns the number of pages in the control.

Return type: int


GetPageImage(selfnPage)

Returns the image index for the given page.

Parameters: nPage (int) –
Return type: int


GetPageText(selfnPage)

Returns the string for the given page.

Parameters: nPage (int) –
Return type: string


GetSelection(self)

Returns the currently selected page, or NOT_FOUND if none was selected.

Note that this method may return either the previously or newly selected page when called from the EVT_BOOKCTRL_PAGE_CHANGED handler depending on the platform and so wx.BookCtrlEvent.GetSelection should be used instead in this case.

Return type: int


HitTest(selfpt)

Returns the index of the tab at the specified position or NOT_FOUND if none.

If flags parameter is not None, the position of the point inside the tab is returned as well.

Parameters: pt (wx.Point) – Specifies the point for the hit test.
Return type: tuple
Returns: intflags )


InsertPage(selfindexpagetextselect=FalseimageId=NO_IMAGE)

Inserts a new page at the specified position.

Parameters:
  • index (int) – Specifies the position for the new page.
  • page (wx.Window) – Specifies the new page.
  • text (string) – Specifies the text for the new page.
  • select (bool) – Specifies whether the page should be selected.
  • imageId (int) – Specifies the optional image index for the new page.
Return type:

bool

Returns:

True if successful, False otherwise.

Note

Do not delete the page, it will be deleted by the book control.

See also

AddPage


RemovePage(selfpage)

Deletes the specified page, without deleting the associated window.

Parameters: page (int) –
Return type: bool


SetPageImage(selfpageimage)

Sets the image index for the given page.

image is an index into the image list which was set with SetImageList .

Parameters:
  • page (int) –
  • image (int) –
Return type:

bool


SetPageSize(selfsize)

Sets the width and height of the pages.

Parameters: size (wx.Size) –

Note

This method is currently not implemented for wxGTK.


SetPageText(selfpagetext)

Sets the text for the given page.

Parameters:
  • page (int) –
  • text (string) –
Return type:

bool


SetSelection(selfpage)

Sets the selection to the given page, returning the previous selection.

Notice that the call to this function generates the page changing events, use the ChangeSelection function if you don’t want these events to be generated.

Parameters: page (int) –
Return type: int

See also

GetSelection

Properties


CurrentPage

See GetCurrentPage


PageCount

See GetPageCount


Selection

See GetSelection and SetSelection

wx.BookCtrlBase的更多相关文章

  1. wx

    wx The classes in this module are the most commonly used classes for wxPython, which is why they hav ...

  2. wx.Notebook

    wx.Notebook This class represents a notebook control, which manages multiple windows with associated ...

  3. wx.onMenuShareTimeline使用注意事项

    我在开发测试过程中,发现使用wx.onMenuShareTimeline无效果,没有显示我定义的图片.title和链接,经过调试发现原因如下: 1.图片大小要大于300pix才能显示 2.这个方法必须 ...

  4. 微信小程序 wx.uploadFile在安卓手机上面the same task is working问题解决

    微信小程序上传图片的时候,如果是多图片上传,一般都是直接用一个循环进行wx.uploadFile 这个在电脑上面测试与苹果手机上面都不会有什么问题 但当用安卓测试的时候,你会发现小程序会提示一个the ...

  5. 微信 小程序 drawImage wx.canvasToTempFilePath wx.saveFile 获取设备宽高 尺寸问题

    以下问题测试环境为微信开发者0.10.102800,手机端iphone6,如有不对敬谢指出. 根据我的测试,context.drawImage,在开发者工具中并不能画出来,只有预览到手机中显示. wx ...

  6. wx.ListCtrl简单使用例子

    效果图: 示例代码: #! /usr/bin/env python #coding=utf-8 import wx import sys packages = [('jessica alba', 'p ...

  7. wx.html2.WebView在 target="_blank" or rel="external" 没有反映的解决方法

    在wx.html2.EVT_WEBVIEW_LOADED中,用WebView.RunScript运行删除链接目标的脚本 javaScriptStr = '''function deleteBlank( ...

  8. referenceerror wx is not defined 微信JsSdk开发

    如果你和我一样遇到了“referenceerror wx is not defined”错误,很有可能是jweixin-1.0.0.js与你其它某js冲突. 解决办法: <script type ...

  9. wxPython安装错误问题:No module named wx

    今天心血来潮安装wxPython,本机win7,且已经安装Python,版本为2.7.3,然后IDE使用的PyCharm,然后wxPython下载的版本为:wxPython2.8-win32-unic ...

随机推荐

  1. 自己封装的一个简易的二维表类SimpleTable

    在QT中,QTableWidget处理二维表格的功能很强大(QTableView更强大),但有时我们只想让它显示少量数据(文字和图片),这时,使用QTableWidget就有点不方便了(个人感觉).所 ...

  2. Android仿微信图片上传,可以选择多张图片,缩放预览,拍照上传等

    仿照微信,朋友圈分享图片功能 .可以进行图片的多张选择,拍照添加图片,以及进行图片的预览,预览时可以进行缩放,并且可以删除选中状态的图片 .很不错的源码,大家有需要可以下载看看 . 微信 微信 微信 ...

  3. Table XXX is marked as crashed and should be repaired问题

    数据表出错了,查询数据获取不到了. 尝试一 重启mysql service mysqld restart 没用,重启并没有把表修复掉 尝试二 check table vicidial_list;rep ...

  4. gem update --system 302 错误 解决方案(转)

    具体过程如下: 1.InstantRails-2.0安装后,在配置环境变量path中配置ruby/bin目录(如果系统中有多个RUBY,执行命令行的时候系统认的就是path中的) 2.进入DOS命令行 ...

  5. OMNeT++安装教程

    前提及注意事项: 1) 安装之前首先要确定已经安装好GCC编译环境(例如:MinGW.Cygwin,选择一种安装); (否则OMNeT++会安装不成功),具体安装教程详见另一篇文章 MinGW安装教程 ...

  6. 浅谈C语言中的强符号、弱符号、强引用和弱引用

    摘自http://www.jb51.net/article/56924.htm 浅谈C语言中的强符号.弱符号.强引用和弱引用 投稿:hebedich 字体:[增加 减小] 类型:转载 时间:2014- ...

  7. 开发SCM系统笔记001

    使用EasyUI分页问题: 1.在分页界面没有显示声明分页属性名称,系统如何获取? EasyUI会向后台发送page\rows两个参数. 2.在配置sql参数时,parametertype与param ...

  8. ORACLE数据库存储结构简介(转)

    首先,oracle数据库的存储结构可以分为逻辑存储结构和物理存储结构,对于这两种存储结构,oracle是分别进行管理的.   逻辑存储结构:oracle内部的组织和管理数据的方式.  物理存储结构:o ...

  9. Map集合重要练习

    重要练习:将字符串中的字母按如下格式显示: a(1)b(2)...... 代码及思路如下: /* 获取字符串中字母的次数,并打印出如下格式a(1)b(2)c(3)...... 思路: 先定义一个方法, ...

  10. android Handler更新UI

    android中经常需要更新界面某个元素的值,但是在主线程中是不可以直接更新主线程的值.这里推荐通过handler机制来更新值. 一Handler的定义: 主要接受子线程发送的数据, 并用此数据配合主 ...