diff --git a/wxPython/src/_event_ex.py b/wxPython/src/_event_ex.py index 70c658a939..03663716d2 100644 --- a/wxPython/src/_event_ex.py +++ b/wxPython/src/_event_ex.py @@ -23,6 +23,12 @@ class PyEventBinder(object): for et in self.evtType: target.Connect(id1, id2, et, function) + def Unbind(self, target, id1, id2): + """Remove an event binding.""" + success = 0 + for et in self.evtType: + success += target.Disconnect(id1, id2, et) + return success != 0 def __call__(self, *args): """ diff --git a/wxPython/src/_evthandler.i b/wxPython/src/_evthandler.i index f4baaacfdb..5a12a452d8 100644 --- a/wxPython/src/_evthandler.i +++ b/wxPython/src/_evthandler.i @@ -106,6 +106,14 @@ public: id = source.GetId() event.Bind(self, id, id2, handler) + def Unbind(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY): + """ + Disconencts the event handler binding for event from self. + Returns True if successful. + """ + if source is not None: + id = source.GetId() + event.Unbind(self, id, id2) }