aui.notebook - how to suppress close button or prevent that it closes the tab

Is there a style which has no close button?

Otherwise I guess have to catch/over ride the close event and just not do the close.

Werner

Hi,

···

On Sun, Sep 19, 2010 at 9:37 AM, werner <wbruhin@free.fr> wrote:

Is there a style which has no close button?

Otherwise I guess have to catch/over ride the close event and just not do
the close.

What style flags are you using when you create your notebook?

The default style has a flag to specify a close button

http://docs.wxwidgets.org/2.8.11/wx_wxauinotebook.html#wxauinotebook

Use a combination of flags that doesn't specify a close button.

Cody

Hi Cody,

Hi,

  Is there a style which has no close button?

Otherwise I guess have to catch/over ride the close event and just not do
the close.

What style flags are you using when you create your notebook?

The default style has a flag to specify a close button

http://docs.wxwidgets.org/2.8.11/wx_wxauinotebook.html#wxauinotebook

Use a combination of flags that doesn't specify a close button.

That was fast!

I should have kept digging a bit, but anyhow I currently use:

         bookStyle = aui.AUI_NB_DEFAULT_STYLE
         bookStyle &= ~(aui.AUI_NB_CLOSE_ON_ACTIVE_TAB)

which I thought should remove the close button, but it is there and when clicking it it closes the tab.

Werner

P.S. I am on wxPython 2.8.11.0.

···

On 19/09/2010 16:48, Cody Precord wrote:

On Sun, Sep 19, 2010 at 9:37 AM, werner<wbruhin@free.fr> wrote:

Hi,

no_close.py (718 Bytes)

···

On Sun, Sep 19, 2010 at 9:53 AM, werner <wbruhin@free.fr> wrote:

Hi Cody,

I should have kept digging a bit, but anyhow I currently use:

   bookStyle = aui\.AUI\_NB\_DEFAULT\_STYLE
   bookStyle &amp;= \~\(aui\.AUI\_NB\_CLOSE\_ON\_ACTIVE\_TAB\)

which I thought should remove the close button, but it is there and when
clicking it it closes the tab.

Works just fine for me on same version of wx.

Just to ask the obvious, did you then pass bookStyle to the
constructors style param?

Cody

Hi Cody,

Hi,

  Hi Cody,

I should have kept digging a bit, but anyhow I currently use:

        bookStyle = aui.AUI_NB_DEFAULT_STYLE
        bookStyle&= ~(aui.AUI_NB_CLOSE_ON_ACTIVE_TAB)

which I thought should remove the close button, but it is there and when
clicking it it closes the tab.

Works just fine for me on same version of wx.

I use agw.aui, so if you change the import to:
import wx.lib.agw.aui as aui

You will see the problem in your sample code too.

Just to ask the obvious, did you then pass bookStyle to the
constructors style param?

Yeap, I do but it could be something I missed:)
Werner

···

On 19/09/2010 17:19, Cody Precord wrote:

On Sun, Sep 19, 2010 at 9:53 AM, werner<wbruhin@free.fr> wrote:

Found it, it is due to the revamp done by Andrea some time ago and I didn't catch on that I need to change this:

self.nb = aui.AuiNotebook(self, style=bookStyle)

to:

self.nb = aui.AuiNotebook(self, agwStyle=bookStyle)

Werner

···

On 19/09/2010 20:18, werner wrote:

Hi Cody,

On 19/09/2010 17:19, Cody Precord wrote:

Hi,

On Sun, Sep 19, 2010 at 9:53 AM, werner<wbruhin@free.fr> wrote:

  Hi Cody,

I should have kept digging a bit, but anyhow I currently use:

        bookStyle = aui.AUI_NB_DEFAULT_STYLE
        bookStyle&= ~(aui.AUI_NB_CLOSE_ON_ACTIVE_TAB)

which I thought should remove the close button, but it is there and when
clicking it it closes the tab.

Works just fine for me on same version of wx.

I use agw.aui, so if you change the import to:
import wx.lib.agw.aui as aui

You will see the problem in your sample code too.

Just to ask the obvious, did you then pass bookStyle to the
constructors style param?

Yeap, I do but it could be something I missed:)