interact button reacting twice
I'm trying to update some old interact to the new Jupyter notebook. I'd like to have an interact with buttons, something like the following:
act = []
@interact
def play(move=selector([None] + ["Auto", "Reset"], buttons=True)):
act.append(move)
print(act)
However when I press a new button, the applet receive it twice. For example, if I press "Auto" and the "Reset" it prints
[None, 'Auto', 'Auto', 'Reset', 'Reset']
instead of
[None, 'Auto', 'Reset']
Is it expected ?
I would say 'no'. Note that when you re-click on the same button, it is only appended once.
Hello. I experimented with your code and didn't experience that curious behavior. Could you check your mouse configuration and/or use only the keyboard to move from button to button and press them?
Do you have additional code in the same Cell?
@dsejas
I got the same result using @Hivert code with numeric keypad Touch 5 for simulating mouse click. On Which OS and Sagemath Version are you dsejas ?
mouse-click-with-keyboard
see also this related post
Hello, @ortollj! I don't remember what version of Sage I was using when I tried to @Hivert's code. However---this is odd!---, I just tried to execute it again in SageMath 9.0, in Ubuntu 18.04, and I have to say that now I can reproduce the behavior. So, maybe this is a bug (?).
As a consequence, I have upvoted the question.