From d2cba3a431d3930ed343be13fd41fe7fdd573684 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Mon, 1 Nov 2021 07:36:14 -0500 Subject: [PATCH 1/2] call bool --- traitsui/qt4/ui_panel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 06bd55312f937e2dfc6a436bb77e6b2d61654c8a Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Mon, 1 Nov 2021 07:41:00 -0500 Subject: [PATCH 2/2] add Bool on wx as well --- traitsui/wx/ui_panel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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