Found a bug in the wx.Notebook class:
Create a notebook, and 2 (or more pages), each with a button
to close that tab in the notebook. The event handler should
include:
def OnCloseButtonClick(self, event):
print "page %i closed" % self.notebook.GetSelection()
self.notebook.DeletePage(self.notebook.GetSelection())
#end def
Select any page except the last, and click the close button
for each page. The output I get is as follows for having
created 3 pages:
page 0 created
page 1 created
page 2 created (this page is selected as it is created)
page 0 selected
page 0 closed
page 1 closed <<<<<<< Wrong, page 0 is open!
page 1 closed <<<<<<< page 1 doesn't exist!
It appears that while "page 0" (the first tab) is visible,
GetSelected() is returning a value indicating that "page 1"
(the second tab) is visible when in fact it is not, and
might not even exist. If I switch to a different tab and
come back, everything works as expected.
--David
David
This is indeed a bug and I entered a bug report for this some
time ago. The link is below. Perhaps you wish to add you sample
code to the bug report.
http://sourceforge.net/tracker/?func=detail&aid=779726&group_id=9863&atid=109863
Nigel
···
On Tue, 7 Oct 2003 18:02:10 -0600 David Morris <lists@morris-clan.net> wrote:
Found a bug in the wx.Notebook class:
Create a notebook, and 2 (or more pages), each with a button
to close that tab in the notebook. The event handler should
include:
def OnCloseButtonClick(self, event):
print "page %i closed" % self.notebook.GetSelection()
self.notebook.DeletePage(self.notebook.GetSelection())
#end def
Select any page except the last, and click the close button
for each page. The output I get is as follows for having
created 3 pages:
page 0 created
page 1 created
page 2 created (this page is selected as it is created)
page 0 selected
page 0 closed
page 1 closed <<<<<<< Wrong, page 0 is open!
page 1 closed <<<<<<< page 1 doesn't exist!
It appears that while "page 0" (the first tab) is visible,
GetSelected() is returning a value indicating that "page 1"
(the second tab) is visible when in fact it is not, and
might not even exist. If I switch to a different tab and
come back, everything works as expected.
--David
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
--
Nigel W. Moriarty
Building 4R0230
Physical Biosciences Division
Lawrence Berkeley National Laboratory
Berkeley, CA 94720-8235
Phone : 510-486-5709
Fax : 510-486-5909
Email : NWMoriarty@LBL.gov
Web : CCI.LBL.gov