This Page

HboxSpacing ExampleΒΆ

hbox_spacing.enaml

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

This example is nearly identical to the `hbox.enaml` example. However,
this time we change the default inter-element spacing from 10 to 30.

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


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

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