wx.Dialog and OnOK

Miki Tebeka <miki.tebeka@zoran.com> writes:

Hello All,

Can someone tell me why the following code does not execute "OnOK" when the
"OK" button is clicked?

Shouldn't you assign a name to the button and then Bind an event to it
as in the demo?

        # Buttons
        hsizer = wx.BoxSizer(wx.HORIZONTAL)

Here the old:

        hsizer.Add(wx.Button(self, wx.ID_OK))
        hsizer.Add(wx.Button(self, wx.ID_CANCEL))

Becomes:

bOK = wx.Button(self, wx.ID_OK)
hsizer.Add(bOK)
bNOK = wx.Button(self, wx.ID_CANCEL)
hsizer.Add(bNOK)

self.Bind(wx.EVT_BUTTON, self.OnOK, bOK)
self.Bind(wx.EVT_BUTTON, self.OnCancel, bNOK)

And it works...

Be seeing you,

···

--
Godoy. <godoy@ieee.org>