This Page

Vertical ExampleΒΆ

vertical.enaml

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

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

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


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

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