enthught TraitsUI ValueEditor自定义树vi中显示的值/对象

2024-09-28 01:23:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用traitsui.api.ValueEditor要为字典创建树视图,请执行以下操作:

class my_editor(HasTraits):
      x = Any   
      traits_view = View(Item('x', editor = ValueEditor()))

a = my_editor(x = my_dict)
a.configure_traits()

输出结果如下:

enter image description here

我想隐藏项目''u listener\u traits'、''u sync\u trait'''u traits\u listener',它们以下划线字符开头。这样树查看器将只显示d、指示符、材料名称、材料、模型树名称。

在查找了ValueEditor的源代码之后,我猜编辑TreeEditor、RootNode或value树节点可能会自定义要查看的特性?这是正确的方法吗?我应该特别编辑哪个来定制ValueEditor?你知道吗


Tags: 名称视图api编辑字典myanyeditor

热门问题