Debian Codegraph @

docs/source/traitsui_user_manual/examples/enum_editor.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 # enum_editor.py -- Example of using an enumeration editor
12
13 from traits.api import Enum, HasTraits
14 from traitsui.api import EnumEditor, Item, View
15
16
17 class EnumExample(HasTraits):
18 priority = Enum('Medium', 'Highest', 'High', 'Low', 'Lowest')
19
20 view = View(
21 Item(
22 name='priority',
23 editor=EnumEditor(
24 values={
25 'Highest': '1:Highest',
26 'High': '2:High',
27 'Medium': '3:Medium',
28 'Low': '4:Low',
29 'Lowest': '5:Lowest',
30 }
31 ),
32 ),
33 )
34
35
36 EnumExample().configure_traits()