diff --git a/traitsui/qt4/ui_panel.py b/traitsui/qt4/ui_panel.py index eef8cf91b..03aa54823 100644 --- a/traitsui/qt4/ui_panel.py +++ b/traitsui/qt4/ui_panel.py @@ -726,7 +726,7 @@ def _evaluate_label_condition(self, conditions, kind): method_to_call = getattr(label, method_dict[kind]) try: cond_value = eval(when, globals(), context) - method_to_call(cond_value) + method_to_call(bool(cond_value)) except Exception: # catch errors in the validate_when expression from traitsui.api import raise_to_debug diff --git a/traitsui/wx/ui_panel.py b/traitsui/wx/ui_panel.py index 69184a33a..5e599b7d0 100644 --- a/traitsui/wx/ui_panel.py +++ b/traitsui/wx/ui_panel.py @@ -732,7 +732,7 @@ def _evaluate_label_condition(self, conditions, kind): method_to_call = getattr(label, method_dict[kind]) try: cond_value = eval(when, globals(), context) - method_to_call(cond_value) + method_to_call(bool(cond_value)) except Exception: # catch errors in the validate_when expression from traitsui.api import raise_to_debug