I recently integrated NotebookCtrl into our program in place
of wx.Notebook. I am very happy with the new features it provides.
I believe I found a couple of problems…
When there are more pages than can fit on a single screen
and a page is added via ctrl.AddPage(win, label, True), the added page is
selected but not scrolled into view. That is, the tab for the new page
may be off screen.
This can be reproduced with the supplied demo program, if
you set the third parameter to AddPage() to True in the series of calls to
AddPage() in the OnAddPage() method. No error output is displayed on the
console.
I attempted to work around this by calling ctrl.SetSelection(…)
for the new page, but that does not work either. I also attempted ctrl.nb.EnsureVisible(…),
but had no luck with that either.
Here is the console output when attempting to utilize
SetSelection():
Traceback (most recent call last):
File
“NotebookCtrlDemo.py”, line 1493, in OnAddPage
self.nb.SetSelection(self.nb.GetPageCount() - 1)
File
“C:\temp\nbctrl\NotebookCtrl.py”, line 4207, in SetSelection
self.nb.SetSelection(nPage)
File
“C:\temp\nbctrl\NotebookCtrl.py”, line 1236, in SetSelection
self.EnsureVisible(self._selection)
File
“C:\temp\nbctrl\NotebookCtrl.py”, line 1255, in EnsureVisible
currect = self._tabrect[selection-self._firstvisible-count]
IndexError: list index out of range
This problem is reproduceable using the supplied demo
program, if you add a call to SetSelection():
self.nb.SetSelection(self.nb.GetPageCount() - 1)
after the series of calls to AddPage() in the OnAddPage()
method.
Environment:
Windows XP
wxPython 2.6.2.1
Python 2.3.2
NotebookCtrl 0.4
I hope this description is good, if not let me know if you
have any questions.
Regards,
Jason