.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.pubsub.utils.misc

.. highlight:: python



.. _wx.lib.pubsub.utils.misc.Callback:

==========================================================================================================================================
|phoenix_title|  **wx.lib.pubsub.utils.misc.Callback**
==========================================================================================================================================

This can be used to wrap functions that are referenced by class
data if the data should be called as a function. E.g. given
>>> def func(): pass
>>> class A:
....def __init__(self): self.a = func
then doing
>>> boo=A(); boo.a()
will fail since Python will try to call a() as a method of boo,
whereas a() is a free function. But if you have instead
"self.a = Callback(func)", then "boo.a()" works as expected.



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>Callback</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.pubsub.utils.misc.Callback_inheritance.svg" alt="Inheritance diagram of Callback" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.pubsub.utils.misc.Callback.html" title="This can be used to wrap functions that are referenced by class" alt="" coords="5,5,269,34"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.pubsub.utils.misc.Callback.__init__`                              Initialize self.  See help(type(self)) for accurate signature.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: Callback

   This can be used to wrap functions that are referenced by class
   data if the data should be called as a function. E.g. given
   >>> def func(): pass
   >>> class A:
   ....def __init__(self): self.a = func
   then doing
   >>> boo=A(); boo.a()
   will fail since Python will try to call a() as a method of boo,
   whereas a() is a free function. But if you have instead
   "self.a = Callback(func)", then "boo.a()" works as expected.

   .. method:: __init__(self, callable_)

      Initialize self.  See help(type(self)) for accurate signature.