File: ex_fluid.rst

package info (click to toggle)
python-enaml 0.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,284 kB
  • sloc: python: 31,443; cpp: 4,499; makefile: 140; javascript: 68; lisp: 53; sh: 20
file content (36 lines) | stat: -rw-r--r-- 1,416 bytes parent folder | download
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
..
  NOTE: This RST file was generated by `make examples`.
  Do not edit it directly.
  See docs/source/examples/example_doc_generator.py

Fluid Example
===============================================================================

An example of how constraints can be used to create fluid layouts.

At the top of the layout is an ``Html`` widget which expands to fill the
available space. Below the ``Html`` are four ``PushButton`` widgets. On the
left are the Add and Remove buttons, which hug the left side of the window
and stay close to each other. Hugging the bottom right corner is the Share
``PushButton``. Centered is the Change Mode ``PushButton``. However, as the
window gets resized, the Change Mode button may not be able to be centered,
but it will always leave a gap between it and its two neighbors. This
type of behavior (selective centering) is difficult-if-not-impossible to
acheive with traditional box style layouts.

.. TIP:: To see this example in action, download it from
 :download:`fluid <../../../examples/layout/advanced/fluid.enaml>`
 and run::

   $ enaml-run fluid.enaml


Screenshot
-------------------------------------------------------------------------------

.. image:: images/ex_fluid.png

Example Enaml Code
-------------------------------------------------------------------------------
.. literalinclude:: ../../../examples/layout/advanced/fluid.enaml
    :language: enaml