interact button reacting twice

asked 2019-10-14 14:16:47 -0600

Hivert gravatar image

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 ?

edit retag flag offensive close merge delete

Comments

I would say 'no'. Note that when you re-click on the same button, it is only appended once.

tmonteil gravatar imagetmonteil ( 2019-10-14 15:34:55 -0600 )edit

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 gravatar imagedsejas ( 2019-10-14 17:24:57 -0600 )edit