Ask Your Question

Revision history [back]

Reset interact control between two uses

I use interact and between two evaluation, I would like the control to come back to its default position, how could I do that?

Here is a simplified example:

a = 0
@interact
def _(b = selector([(-1,""),(0,"0"),(1,"1"),(2,"2")]), auto_update=False):
    global a
    if b != -1:
        a = a + b
    print(a)

I would like the selector to come back to the position (-1,"") after an evaluation.

Would someone know how to do that?