X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fc71d09b42c69406f1b5da07cef9924807557a23..b0cafb9172d567c99b2ede1606e750bf69abc704:/wxPython/src/_core_ex.py diff --git a/wxPython/src/_core_ex.py b/wxPython/src/_core_ex.py index 5d1dcd409d..855ba7e768 100644 --- a/wxPython/src/_core_ex.py +++ b/wxPython/src/_core_ex.py @@ -90,7 +90,6 @@ class _wxPyUnbornObject(object): #---------------------------------------------------------------------------- -_wxPyCallAfterId = None def CallAfter(callable, *args, **kw): """ @@ -104,19 +103,17 @@ def CallAfter(callable, *args, **kw): app = wx.GetApp() assert app is not None, 'No wx.App created yet' - global _wxPyCallAfterId - if _wxPyCallAfterId is None: - _wxPyCallAfterId = wx.NewEventType() - app.Connect(-1, -1, _wxPyCallAfterId, - lambda event: event.callable(*event.args, **event.kw) ) + if not hasattr(app, "_CallAfterId"): + app._CallAfterId = wx.NewEventType() + app.Connect(-1, -1, app._CallAfterId, + lambda event: event.callable(*event.args, **event.kw) ) evt = wx.PyEvent() - evt.SetEventType(_wxPyCallAfterId) + evt.SetEventType(app._CallAfterId) evt.callable = callable evt.args = args evt.kw = kw wx.PostEvent(app, evt) - #----------------------------------------------------------------------------