Debian Codegraph @

integrationtests/ui/enum_dynamic_test.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 from traits.api import HasTraits, List, Str
12 from traitsui.api import EnumEditor, Item, View
13
14
15 def evaluate_value(v):
16 print('evaluate_value', v)
17 return str(v)
18
19
20 class Team(HasTraits):
21
22 captain = Str('Dick')
23 players = List(['Tom', 'Dick', 'Harry', 'Sally'], Str)
24
25 captain_editor = EnumEditor(name='players', evaluate=evaluate_value)
26
27 view = View(
28 Item('captain', editor=captain_editor), '_', 'players@', height=200
29 )
30
31
32 if __name__ == '__main__':
33 team = Team()
34 team.configure_traits()
35 team.print_traits()