Spin Box Example

An example of the SpinBox widget.

This example demonstrates the use of a simple SpinBox control which is used to select from a discrete range of integer values.

Tip

To see this example in action, download it from spin_box and run:

$ enaml-run spin_box.enaml

Screenshot

../_images/ex_spin_box.png

Example Enaml Code

#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
""" An example of the `SpinBox` widget.

This example demonstrates the use of a simple `SpinBox` control which is
used to select from a discrete range of integer values.

<< autodoc-me >>
"""
from enaml.widgets.api import Window, Form, Label, Field, SpinBox
from enaml.layout.api import hbox, vbox


enamldef Main(Window):
    title = 'SpinBox Example'
    Form:
        Label: lbl:
            text = 'Select Age'
        SpinBox: sbox:
            maximum = 100
            minimum = 0
        Field: fld:
            text << 'Age: {}'.format(sbox.value)
            read_only = True