From b4a4f8f7ba561b546e65499cf5eb2d47152becdf Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 26 Apr 2013 07:04:33 +0000 Subject: [PATCH] Add section about wx.PyEvent and wx.PyCommandEvent git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/MigrationGuide.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/MigrationGuide.txt b/docs/MigrationGuide.txt index 70177d8e..7ba21c17 100644 --- a/docs/MigrationGuide.txt +++ b/docs/MigrationGuide.txt @@ -396,6 +396,32 @@ Frame for the content. +wx.PyEvent and wx.PyCommandEvent +-------------------------------- + +Unlike some other wx.Py classes these two still exist in Phoenix, and are +still the base classes that you should use when creating your own custom +event classes. For the most part they work just like they did in Classic, and +they take care of ensuring that any Python attributes that you assign to +instances of the class will still be there when the event is delivered to an +event handler. There is one main difference from Classic however, and that is +that those attributes are now stored in a dictionary object owned by the C++ +instance, instead of being stored directly in the Python instance's +dictionary. In most cases this won't matter to you at all, but if your +derived class has a __getattr__ method (or __setattr__ or __delattr__) then +you will need to get the attributes from that other dictionary instead. You +can get a reference to that dictionary using _getAttrDict(). For example:: + + def __getattr__(self, name): + d = self._getAttrDict() + if name in d: + return d[name] + return getattr(self._someOtherThing, name) + + + + + .. toctree:: :maxdepth: 2 :hidden: