~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_group.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_group.py -- Sample code to demonstrate configure_traits()
 
6
 
 
7
#--[Imports]--------------------------------------------------------------------
 
8
from traits.api import HasTraits, Str, Int
 
9
from traitsui.api import View, Item, Group
 
10
import traitsui
 
11
 
 
12
#--[Code]-----------------------------------------------------------------------
 
13
 
 
14
class SimpleEmployee(HasTraits):
 
15
    first_name = Str
 
16
    last_name = Str
 
17
    department = Str
 
18
 
 
19
    employee_number = Str
 
20
    salary = Int
 
21
 
 
22
view1 = View(Group(Item(name = 'first_name'),
 
23
                   Item(name = 'last_name'),
 
24
                   Item(name = 'department'),
 
25
                   label = 'Personnel profile',
 
26
                   show_border = True))
 
27
 
 
28
 
 
29
sam = SimpleEmployee()
 
30
sam.configure_traits(view=view1)
 
31