This Page

Horizontal ExampleΒΆ

horizontal.enaml

#------------------------------------------------------------------------------
#  Copyright (c) 2012, Enthought, Inc.
#  All rights reserved.
#------------------------------------------------------------------------------
""" An example which demonstrates the use of the `horizontal` layout 
helper.

This example uses the `horizontal` layout helper to arrange a series of
`PushButton` widgets in a horizontal layout. No constraints are placed 
on the vertical position of the `PushButton` widgets so their vertical
location in this example is non-deterministic.

"""
from enaml.layout.api import horizontal
from enaml.widgets.api import Window, Container, PushButton


enamldef Main(Window):
    Container:
        constraints = [
            horizontal(left, pb1, pb2, pb3, right),
        ]
        PushButton:
            id: pb1
            text = 'Spam'
        PushButton:
            id: pb2
            text = 'Long Name Foo'
        PushButton:
            id: pb3
            text = 'Bar'

$ enaml-run horizontal.enaml
../_images/horizontal.png