AuiNotebook catch 22

There are two AuiNotebook implementations, one in wx.aui, and one in wx.lib.agw.aui.
The former honors the AUI_NB_CLOSE_ON_ALL_TABS flag, but doesn’t support SetCloseButton.
The latter ignores AUI_NB_CLOSE_ON_ALL_TABS, and, because of that, throws an exception on calls to SetCloseButton, complaining that ALL_TABS is not set.

What’s a poor programmer to do? And, in general, which is the correct .aui to be using? I assume the wx.lib.agw.aui one, but (for my purposes) its AuiNotebook is inferior to the wx.aui one.

Are you positive that wx.lib.agw.aui ignores that style? From this message:

https://groups.google.com/forum/m/#!topic/wxPython-users/buMaDIPQIdI

It looks like I have implemented it back in 2009… does it work in the demo?

Andrea.

I haven’t tried the demo. I just imported the library and tried it on my project.

Then I believe you should try it. Unless something major has changed between Classic and Phoenix for wx.lib.agw.aui - which I find improbable - then it should just work. Alternatively, you might want to provide a small sample app demonstrating the problem.

I tried this app. I get closes on both tabs with aui but only on the selected tab with wx.lib.agw.aui

notebooks.py (940 Bytes)

All the widgets in the AGW package expect that the style you pass is named agwStyle (not style), I.e. you shouldn’t use this call:

notebook = self.notebook = aui.AuiNotebook(panel, style=aui.AUI_NB_CLOSE_ON_ALL_TABS)

But this:

notebook = self.notebook = aui.AuiNotebook(panel, agwStyle=aui.AUI_NB_CLOSE_ON_ALL_TABS)

And it is also very nicely shown in the wxPython documentation here:

https://wxpython.org/Phoenix/docs/html/wx.lib.agw.aui.auibook.AuiNotebook.html#wx.lib.agw.aui.auibook.AuiNotebook

1 Like

Thank you very much – it might have taken me a while to see that difference.

Or here, in the docs for the current release:
https://docs.wxpython.org/wx.lib.agw.aui.auibook.AuiNotebook.html#wx.lib.agw.aui.auibook.AuiNotebook

:smiley: