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
This commit is contained in:
Robin Dunn
2013-04-26 07:04:33 +00:00
parent 629403af5e
commit b4a4f8f7ba

View File

@@ -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: