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

« back to all changes in this revision

Viewing changes to examples/tutorials/doc_examples/examples/configure_traits_view_buttons.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
 
 
5
# configure_traits_view_buttons.py -- Sample code to demonstrate
 
6
#                                     configure_traits()
 
7
 
 
8
#--[Imports]--------------------------------------------------------------------
 
9
from traits.api import HasTraits, Str, Int
 
10
from traitsui.api import View, Item
 
11
from traitsui.menu import OKButton, CancelButton
 
12
 
 
13
#--[Code]-----------------------------------------------------------------------
 
14
 
 
15
class SimpleEmployee(HasTraits):
 
16
    first_name = Str
 
17
    last_name = Str
 
18
    department = Str
 
19
 
 
20
    employee_number = Str
 
21
    salary = Int
 
22
 
 
23
view1 = View(Item(name = 'first_name'),
 
24
             Item(name = 'last_name'),
 
25
             Item(name = 'department'),
 
26
             buttons = [OKButton, CancelButton])
 
27
 
 
28
sam = SimpleEmployee()
 
29
sam.configure_traits(view=view1)
 
30