To reproduce:
class Foo(HasTraits):
true_or_false = Int()
def default_traits_view(self):
return View(
Item(
"true_or_false",
editor=EnumEditor(
values=[0, 1],
format_func=lambda v: str(bool(v)).upper(),
)
)
)
foo = Foo()
foo.configure_traits()
One expects to see the "TRUE" and "FALSE" in the dropdown. However one gets "0" and "1" in the view, which is unexpected.

Printing the mapping:
ui = foo.edit_traits()
editor, = ui.get_editors("true_or_false")
print(editor.mapping)
ui.dispose()
We get:
If I create the editor first and then mutates the values, then I get the expected behaviour:
def default_traits_view(self):
editor = EnumEditor(
format_func=lambda v: str(bool(v)).upper(),
)
# trigger _values_changed to fire
editor.values = [0, 1]
return View(
Item(
"true_or_false",
editor=editor,
)
)

To reproduce:
One expects to see the "TRUE" and "FALSE" in the dropdown. However one gets "0" and "1" in the view, which is unexpected.

Printing the mapping:
We get:
If I create the editor first and then mutates the
values, then I get the expected behaviour: