View定义界面
使用View来自定义界面
class ModelManager(HasTraits):
model_name = Str
category = Str
model_file = Str
model_number = Int view = View(
Item("model_name", label=u"模型名称"), #将Traits属性和Item关联起来,分别定义标签,中文需要使用u
Item("model_file", label=u"文件名"),
Item("category", label=u"模型类型"),
Item("model_number", label=u"模型数量"),
title=u"模型资料",
width=,
resizable=True
) model = ModelManager()
model.configure_traits()