Re: wxNotebook and DeleteAllPages()
Robin Dunn <[email protected]>
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
PyMapper Developer wrote:
> Okay, that makes sense. So, in changing the code to add three new
> panels instead
>
> nbPanel1 = wx.Window(self.testNotebook)
> nbPanel2 = wx.Window(self.testNotebook)
> nbPanel3= wx.Window(self.testNotebook)
> self.testNotebook.AddPage(nbPanel1, "test1")
> self.testNotebook.AddPage(nbPanel2, "test2")
> self.testNotebook.AddPage(nbPanel3, "test3")
>
> I end up with this error instead once I try to do the DeleteAllPages()
>
> wx._core.wxAssertionError: C++ assertion "(int)m_pages.Count() ==
> (int)::SendMessageW((((HWND)GetHWND())), (0x1300 + 4), 0, 0L)" failed
> at ..\..\src\msw\notebook.cpp(343) in wxNotebook::GetPageCount():
>
> Visually, I see the Notebook in the frame get the new page right
> before it crashes.
Ok, it looks like the wrong DeleteAllPages method is being called on
Windows, it works fine on the other platforms. On Windows it is calling
only the base class method and so the tabs in the native widget are not
being removed. I'll fix that problem for the next release. In the
meantime you can call DeletePage for each tab.
def DeletePages(self, event):
#self.testNotebook.DeleteAllPages()
while self.testNotebook.GetPageCount():
self.testNotebook.DeletePage(0)
otherPanel = wx.Window(self.testNotebook)
self.testNotebook.AddPage(otherPanel, "NewPanel")
--
Robin Dunn
Software Craftsman
http://wxPython.org
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.