| 1 |
# (C) Copyright 2004-2023 Enthought, Inc., Austin, TX |
| 2 |
# All rights reserved. |
| 3 |
# |
| 4 |
# This software is provided without warranty under the terms of the BSD |
| 5 |
# license included in LICENSE.txt and may be redistributed only under |
| 6 |
# the conditions described in the aforementioned license. The license |
| 7 |
# is also available online at http://www.enthought.com/licenses/BSD.txt |
| 8 |
# |
| 9 |
# Thanks for using Enthought open source! |
| 10 |
|
| 11 |
# wizard.py -- Example of a traits-based wizard UI |
| 12 |
|
| 13 |
from traits.api import HasTraits, Str |
| 14 |
from traits.etsconfig.api import ETSConfig |
| 15 |
from traitsui.api import Item, View, VGroup |
| 16 |
|
| 17 |
|
| 18 |
class Person(HasTraits): |
| 19 |
first_name = Str() |
| 20 |
last_name = Str() |
| 21 |
|
| 22 |
company = Str() |
| 23 |
position = Str() |
| 24 |
|
| 25 |
view = View( |
| 26 |
VGroup(Item("first_name"), Item("last_name")), |
| 27 |
VGroup(Item("company"), Item("position")), |
| 28 |
) |
| 29 |
|
| 30 |
|
| 31 |
person = Person( |
| 32 |
first_name='Postman', |
| 33 |
last_name='Pat', |
| 34 |
company="Enthought", |
| 35 |
position="Software Developer", |
| 36 |
) |
| 37 |
|
| 38 |
|
| 39 |
if ETSConfig.toolkit == "wx": |
| 40 |
# Wizard window is currently only available for wx backend. |
| 41 |
person.configure_traits(kind='wizard') |