From 25b00b4e8cde9aed9d19746e82bf5c0200f5699b Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 13 Nov 2001 03:17:09 +0000 Subject: [PATCH] Passing None to an EVT_* function will Disconnect git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12396 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/msw/windows.cpp | 8 ++++++++ wxPython/src/windows.i | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/wxPython/src/msw/windows.cpp b/wxPython/src/msw/windows.cpp index e84c9a3f50..63dd54c338 100644 --- a/wxPython/src/msw/windows.cpp +++ b/wxPython/src/msw/windows.cpp @@ -472,6 +472,14 @@ static void wxEvtHandler_Connect(wxEvtHandler *self,int id,int lastId,int ev (wxObjectEventFunction) &wxPyCallback::EventThunker, new wxPyCallback(func)); } + else if (func == Py_None) { + self->Disconnect(id, lastId, eventType, + (wxObjectEventFunction) + &wxPyCallback::EventThunker); + } + else { + PyErr_SetString(PyExc_TypeError, "Expected callable object or None."); + } } static PyObject *_wrap_wxEvtHandler_Connect(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; diff --git a/wxPython/src/windows.i b/wxPython/src/windows.i index 0da45474bc..53d137d72b 100644 --- a/wxPython/src/windows.i +++ b/wxPython/src/windows.i @@ -63,6 +63,14 @@ public: (wxObjectEventFunction) &wxPyCallback::EventThunker, new wxPyCallback(func)); } + else if (func == Py_None) { + self->Disconnect(id, lastId, eventType, + (wxObjectEventFunction) + &wxPyCallback::EventThunker); + } + else { + PyErr_SetString(PyExc_TypeError, "Expected callable object or None."); + } } bool Disconnect(int id, int lastId = -1, -- 2.45.2