double call in EVT_NOTEBOOK_PAGE_CHANGED

Hello,

Im using EVT_NOTEBOOK_PAGE_CHANGED. I have a wx.Notebook, self.NBook,
with 2 tabs and Id like to call a dialog when a tab’s change occur. So I use the following lines:

self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.changeTab,self.NBook)


And inside changeTab( ), I use

        if ( self.NBook.GetSelection( ) == 0 ): # to control when it is in the first Tab.

            dlg = wx.MessageDialog(self, info_text, " INFO Note",
                           wx.YES_NO| wx.ICON_INFORMATION|wx.ICON_QUESTION)
   
       
            if(dlg.ShowModal() == wx.ID_YES):
       
                dlg.ShowModal()
                dlg.Destroy()

            # and some code in here

And my problem is that, i dont know why, I get the dialog window twice ! ! ! It seems its calling the event
before the change was completely done. Any Idea?

Thanks in advance!

Leticia.

···

Enviado desde Correo Yahoo!
La bandeja de entrada más inteligente.

Hi Leticia,

Im using EVT_NOTEBOOK_PAGE_CHANGED. I have a wx.Notebook, self.NBook,
with 2 tabs and Id like to call a dialog when a tab's change occur. So I use
the following lines:

   self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.changeTab,self.NBook)

Try this:

self.NBook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.changeTab)

Not sure if it will work, but if my memory serves well the reason is here:

http://wiki.wxpython.org/self.Bind%20vs.%20self.button.Bind

Andrea.

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

···

On Tue, Jun 3, 2008 at 10:55 AM, leticia Fernandez wrote: