.. currentmodule:: sardana.macroserver.macro .. _sardana-devel-examples: ======== Examples ======== This chapter gathers a series of macro examples distributed with Sardana. The example modules shown below can be found in the :mod:`sardana.macroserver.macros.examples` package. .. _sardana-devel-macro-examples: Macro examples ============== .. _sardana-devel-macro-parameter-examples: Macro parameter examples ------------------------ The following examples demonstrate how to declare macros which receive parameter(s). See :ref:`sardana-macro-parameters` for a tutorial on macro parameters. .. literalinclude:: ../../../../src/sardana/macroserver/macros/examples/parameters.py :language: python :linenos: .. _sardana-devel-macro-call-examples: Macro call examples ------------------- The following examples demonstrate how to call macros from inside a macro. See :ref:`sardana-macro-calling` for a tutorial on calling macros. .. literalinclude:: ../../../../src/sardana/macroserver/macros/examples/submacros.py :language: python :linenos: .. _sardana-devel-macro-hooks-examples: Macro hooks examples -------------------- The following examples demonstrate how to define hookable macros and how to programmatically attach hooks to macros. See :ref:`sardana-macros-hooks` and :ref:`sardana-macro-adding-hooks-support` for more information. .. literalinclude:: ../../../../src/sardana/macroserver/macros/examples/hooks.py :language: python :linenos: .. _sardana-devel-macro-scans-examples: Macro scans examples -------------------- The following examples demonstrate specific features or tricks for programming custom scan macros using the Sardana :ref:`scan framework `. .. literalinclude:: ../../../../src/sardana/macroserver/macros/examples/scans.py :language: python :linenos: .. _sardana-devel-macro-plotting-examples: Macro plotting examples ----------------------- The following examples demonstrate how to plot graphics from inside a macro. See :ref:`sardana-macro-plotting` for a tutorial on macro plotting. The complete set of :mod:`~matplotlib.pyplot` examples can be found in the `matplotlib gallery `_. .. literalinclude:: ../../../../src/sardana/macroserver/macros/examples/plotting.py :language: python :linenos: .. _sardana-devel-macro-input-examples: Macro input examples -------------------- The following examples demonstrate how to ask for user input inside macros. A tutorial on macro input parameter can be found :ref:`here `. The :term:`API` documentation: :meth:`~Macro.input`. .. literalinclude:: ../../../../src/sardana/macroserver/macros/examples/user_input.py :language: python :linenos: .. _sardana-devel-controller-examples: Controller examples =================== Controller examples are discussed together with each controller type in the :ref:`Writing controllers ` guides. The *Springfield* example controllers used throughout those guides can be found next to the guide sources.