Using python build-in in panelexec


I am trying to use a python build-in function in a slider event handler
For example rounding the panelValue inside a panelexec chop:

def onValueChange(panelValue, prev):
    value = round(panelValue, 2)

that rises a TypeError: td.PanelValue doesn’t define round method

Do I have to import something, or change the scope to use python build_in methods ?

Hi michapau,
you don’t need to import anything, use panelValue.val instead.
the PanelValue Class is described here:

1 Like

oh, yes, that worked, thank you…

I thought the error message was related to that it couldn’t find a definition for round at all,
because I supposed that panelValue is just a (float) value and not a class…

but actually it says TypeError so it makes totally sense.