Debian Codegraph @

docs/source/traitsui_user_manual/examples/multiple_views.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 # multiple_views.py -- Sample code to demonstrate the use of multiple views
12
13 from traits.api import HasTraits, Str, Int
14 from traitsui.api import View, Item, Group
15
16
17 class SimpleEmployee3(HasTraits):
18 first_name = Str()
19 last_name = Str()
20 department = Str()
21
22 employee_number = Str()
23 salary = Int()
24
25 traits_view = View(
26 Group(
27 Item(name='first_name'),
28 Item(name='last_name'),
29 Item(name='department'),
30 label='Personnel profile',
31 show_border=True,
32 ),
33 )
34
35 all_view = View(
36 Group(
37 Item(name='first_name'),
38 Item(name='last_name'),
39 Item(name='department'),
40 Item(name='employee_number'),
41 Item(name='salary'),
42 label='Personnel database entry',
43 show_border=True,
44 ),
45 )
46
47
48 sam = SimpleEmployee3()
49 sam.configure_traits()
50 sam.configure_traits(view='all_view')