Debian Codegraph @

docs/source/traitsui_user_manual/examples/mixed_styles.py

raw
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 # mixed_styles.py -- Example of using editor styles at various levels
12
13 from traits.api import Enum, HasTraits, Str
14 from traitsui.api import Group, Item, View
15
16
17 class MixedStyles(HasTraits):
18 first_name = Str()
19 last_name = Str()
20
21 department = Enum("Business", "Research", "Admin")
22 position_type = Enum("Full-Time", "Part-Time", "Contract")
23
24 traits_view = View(
25 Group(
26 Item(name='first_name'),
27 Item(name='last_name'),
28 Group(
29 Item(name='department'),
30 Item(name='position_type', style='custom'),
31 style='simple',
32 ),
33 ),
34 title='Mixed Styles',
35 style='readonly',
36 )
37
38
39 ms = MixedStyles(first_name='Sam', last_name='Smith')
40 ms.configure_traits()