in traitsui, item(), possible setup visible_when() parameter list more 1 item?
for example, i'd this:
group( item(firstitem, visible_when = 'foo == 1 , bar == 0'), item(seconditem, visible_when = 'foo == 0 , bar == 1), item(thirditem, visible_when = 'foo == 0 , bar == 0) )
so firstitem, seconditem, or thirditem show based on values in foo , bar.
is possible? i've made initial attempt, had no luck (which may because 1 of logic tests involves string -- problem having string test inside visible_when string? visible_when test looks (and isn't working):
visible_when = 'initial_value == 1 && display_units == \'si\'',
i've tried si in double quotes "si" , escaped single quotes above...neither worked me. i've tried using 'and' , '&&' no difference either.
yes, multiple tests work. verify this, run modified https://raw.githubusercontent.com/enthought/traitsui/master/examples/demo/dynamic_forms/visible_when.py, change, example, 2 visible_when conditions these:
visible_when = 'age < 18 , last_name=="smith"',
and
visible_when = 'age >= 18 or last_name!="smith"',
i suggest checking assumptions data contents.
(btw, strings can use either either double or escaped single quotes -- suggest double quotes readability)