[wxPython-users] Capture close event of a tab in an aui.notebook

Andrea Gavana andrea.gavana at gmail.com
Thu Sep 13 06:03:06 PDT 2007


Hi Dominique,

On 9/11/07, Dominique wrote:
> The objective is that when the user closes a tab, several variables are updated.
> I tried on and on without success.
>
> Here is what I think I should do:
>
> #When the tab is created
> self.notebook.AddPage(self.page,"PageLabel")
>
> # Then I try to bind the newly created tab with the close event
> self.page.Bind(wx.EVT_CLOSE,self.DestroyTab)

I would do something like:

self.theAuiNotebook.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.DestroyTab)

# Then I define the function

def DestroyTab(self,event):
    # I do the updates on other variables...

    # Then call event.Skip(), the page is destroyed
    event.Skip()


Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/




More information about the wxpython-users mailing list