Debian Codegraph @

docs/source/traitsui_user_manual/examples/default_traits_view2.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 # default_traits_view2.py -- Sample code to demonstrate the use of
12 # 'default_traits_view'
13
14 from traits.api import HasTraits, Str, Int
15 from traitsui.api import View, Item, Group
16
17
18 class SimpleEmployee2(HasTraits):
19 first_name = Str()
20 last_name = Str()
21 department = Str()
22
23 employee_number = Str()
24 salary = Int()
25
26 def default_traits_view(self):
27 return View(
28 Group(
29 Item(name='first_name'),
30 Item(name='last_name'),
31 Item(name='department'),
32 label='Personnel profile',
33 show_border=True,
34 ),
35 )
36
37
38 sam = SimpleEmployee2()
39 sam.configure_traits()