Notebook and DeleteAllPages


I am updating an old code. I am not sure whether I am on right track, but…


  1. An dialog window resizes by itself. Step by step follow shows correct size until it comes to rv = wx.PyApp.MainLoop(self) and resizes (very small), everything squashed
  2. An error Adding a window already in a sizer, detach it first!, when article is changed to something else. pops out at sizerA.Add(self.notebook_1,...) where sizerA is empty. Also, detaching notebook_1 by sizerA.Detach(self.notebook_1) does not work. notebook_1 is wx.Notebook(…).
  3. Thers is no other error message.

Tracing execution steps, both problems happen after self.notebook_1.DeleteAllPages().
Following this page,, wx.CallAfter is tried, resulting an error.

Where can I find a documentation notebook.DeleteAllPages() ? Changelog (5-Jan-2019) says it is declared. I can find DeleteAllPages in several other subclasses.

wxpython version is 4.2.1 gtk3 (phoemix) wxwidgets 3.2.2

I appreciate any suggestion.

Thank you in advance.

Hi @penguin2100,

The API reference is found in the homepage.

See wx.Notebook — wxPython Phoenix 4.2.1 documentation. If you can’t find the API, it might be defined in the superclass. Click “Class Hierarchy” and wx.BookCtrlBase.

Then, you can find DeleteAllPages: wx.BookCtrlBase — wxPython Phoenix 4.2.1 documentation
I hope it helps.

Thank you for your reply. Apology for delay, I was away for a week.

Yes, it makes sense.
I was careless that I missed BookCtrlBase is a superclass. Class Hierarchy tree was off, so I did not go further.