例1,Employee
from traits.api import HasTraits, Int, Str, Float
class Employee(HasTraits):
name = Str
department = Str
salary = Int
bouns = Float
e = Employee()
e.configure_traits()
例2, 分成2个标签页
from traitsui.api import View, Group, Item
class Employee...
view = View(
Group(
Item(name = 'name', label = u'姓名'),
Item(name = 'department, label = u'部门'),
label = u'个人信息',
show_border = True),
Group(
Item(name = 'salary', label = u'工资'),
Item(name = 'bouns', label = u'奖金'),
label = u'收入',
show_border = True))
sun = Employee()
sun.configure_traits(view = view)
#注意到此时的UI页面,没有“Cancel”/“OK”按键
例3,