Examples
==========

Hello World
------------

A complete example of use:

.. literalinclude:: helloworld.py


Running the above as a script (already saved for your convenience as
helloworld.py in the docs folder of the source distribution) will
produce the result::

    lahdida... have result, publishing it via pubsub
    Function listener1 received:
      arg1="123"
      arg2="{'a': 'abc', 'b': 'def'}"


More Examples
--------------

There are several examples that can be found in the source distribution
in the ``examples`` folder. There are some "basic" examples that
focus on syntax, and more advanced examples that hint at some design
pattern. In most cases, there are both "console"-based and GUI (wxPython)
based examples.

On Windows, the whole set of examples in the ``examples`` folder can
be executed automatically as a form of regression testing. Run ``runall.bat``
from a console window once cd'd to the examples folder. Read the text in
the console for instructions.

The examples described below can be `browsed online`_. 

.. _browsed online: http://pubsub.svn.sourceforge.net/viewvc/pubsub/trunk/examples/

Basic, Kwargs messaging
^^^^^^^^^^^^^^^^^^^^^^^^

.. include:: ../../examples/basic_kwargs/README.txt

Basic, Arg1 messaging
^^^^^^^^^^^^^^^^^^^^^^

.. include:: ../../examples/basic_arg1/README.txt

Basic, old API
^^^^^^^^^^^^^^^

.. include:: ../../examples/basic_v1/README.txt

Advanced
^^^^^^^^^^^^^^^

.. include:: ../../examples/advanced/README.txt