Traits——信息输入界面

from traits.api import HasTraits, Str, Int
from traitsui.api import View, Item, Group
class Simple(HasTraits):
    first_name = Str
    last_name = Str
    department = Str
    employee_number = Str
    salary = Str
    bonus = Int
view1= View(
    Group(
        Item(name = "employee_number", label=u"编号"),
        Item(name = 'department',label=u"部门",tooltip=u"在哪个部门干活"),
        Item(name = "last_name",label=u''),
        Item(name = 'first_name',label=u''),
        label = u"个人信息",
        show_border = True
    ),
    Group(
        Item(name = 'salary',label=u'工资'),
        Item(name = 'bonus',label=u"奖金"),
        label=u'收入',
        show_border = True
        )
)

sam = Simple()
sam.configure_traits(view=view1)

 

 

 

posted @ 2021-03-17 22:07  朵朵奇fa  阅读(69)  评论(0编辑  收藏  举报