~ubuntu-branches/ubuntu/utopic/python-traitsui/utopic

« back to all changes in this revision

Viewing changes to examples/tutorials/doc_examples/examples/enum_editor.py

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2011-07-09 13:57:39 UTC
  • Revision ID: james.westby@ubuntu.com-20110709135739-x5u20q86huissmn1
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#  Copyright (c) 2007, Enthought, Inc.
 
2
#  License: BSD Style.
 
3
 
 
4
# enum_editor.py -- Example of using an enumeration editor
 
5
 
 
6
#--[Imports]--------------------------------------------------------------------
 
7
from traits.api import HasTraits, Enum
 
8
from traitsui.api import EnumEditor, View, Item
 
9
 
 
10
#--[Code]-----------------------------------------------------------------------
 
11
 
 
12
class EnumExample(HasTraits):
 
13
    priority = Enum('Medium', 'Highest',
 
14
                              'High',
 
15
                              'Medium',
 
16
                              'Low',
 
17
                              'Lowest')
 
18
 
 
19
    view = View( Item(name='priority',
 
20
                      editor=EnumEditor(values={
 
21
                          'Highest' : '1:Highest',
 
22
                          'High'    : '2:High',
 
23
                          'Medium'  : '3:Medium',
 
24
                          'Low'     : '4:Low',
 
25
                          'Lowest'  : '5:Lowest', })))
 
26