We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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:
{'0': 0, '1': 1}
If I create the editor first and then mutates the values, then I get the expected behaviour:
values
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, ) )
The text was updated successfully, but these errors were encountered:
ievacerny
Successfully merging a pull request may close this issue.
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:The text was updated successfully, but these errors were encountered: