有没有办法为HasTraits
对象定义多个视图,并在将它们显示为Item
时选择它们?你知道吗
class Person(HasTraits):
first_name = String()
last_name = String()
formal_view = View(
Item('first_name'),
Item('last_name'),
)
familiar_view = View(
Item('first_name')
)
class Family(HasTraits):
formal_father = Instance(Person,())
familiar_father = Instance(Person,())
view = View(
Item('formal_father', style = 'custom'),
Item('familiar_father', style = 'custom',
view = 'familiar_view'),
)
最后一项中的关键字view
只是为了说明我希望它如何工作。你知道吗
是的,你差不多成功了。看到了吗 http://code.enthought.com/projects/traits/docs/html/TUIUG/advanced_view.html#defining-multiple-views-within-the-model
相关问题 更多 >
编程相关推荐