1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
..
NOTE: This RST file was generated by `make examples`.
Do not edit it directly.
See docs/source/examples/example_doc_generator.py
Button Ring Example
===============================================================================
An example layout which is impossible with typical layout systems.
This example creates a ring of 50 ``PushButton`` widgets with a ``Label`` in
the center. The constraints shown here are generally silly in that the
resulting layout is more-or-less useless. Nevertheless, it serves well to
demonstrate the power and flexibility of constraints-based layout.
Note that the 'gen_constraints' function is only called once, not on
every resize as may be expected when laying out widgets manually.
Note that this example also demonstrates that constraints may be defined
on any subclass of ``ConstraintsWidget``. They need not be confined to a
``Container``.
Requires numpy to be installed.
.. TIP:: To see this example in action, download it from
:download:`button_ring <../../../examples/layout/advanced/button_ring.enaml>`
and run::
$ enaml-run button_ring.enaml
Screenshot
-------------------------------------------------------------------------------
.. image:: images/ex_button_ring.png
Example Enaml Code
-------------------------------------------------------------------------------
.. literalinclude:: ../../../examples/layout/advanced/button_ring.enaml
:language: enaml
|