[wxPython] Problems with wxGenButton

Hi,

I have a problem with the wxGenButton.

In the following example I open a new Dialog by pressing the wxGenButton.
Every time I pressed the X-Button to close the new dialog, the message
handler function of the wxGenButton in the first dialog is called.
With the original wxButton I have no problems.

Dirk

···

______________________________________________________

from wxPython.wx import *
from wxPython.lib.buttons import wxGenButton

wxID_BUTTON_OPEN = NewId()

class MyDialog(wxDialog):

#--------------------------------------------------------------------------
    # __init__
    #
    def __init__(self, parent):
        wxDialog.__init__(self, parent, -1, 'MyDialog', size = wxSize(200,
200))

# self.buttonOpen = wxButton(self, wxID_BUTTON_OPEN, 'Open...')
        self.buttonOpen = wxGenButton(self, wxID_BUTTON_OPEN,
"Open...(GenButton)")
        
        EVT_BUTTON(self.buttonOpen, wxID_BUTTON_OPEN, self.OnButtonOpen)
        
#--------------------------------------------------------------------------
    # OnButtonOpen
    #
    def OnButtonOpen(self, event):
        dlg = wxDialog(self, -1, "Test Dialog", size = wxSize(100, 100))
        dlg.ShowModal()
        dlg.Destroy()

#***************************************************************************
***
#
#
if __name__ == '__main__':
    app = wxPySimpleApp()

    dlg = MyDialog(None)
    dlg.ShowModal()
    dlg.Destroy()

    app.MainLoop()