Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RadioButton fires duplicate events on click #159

Open
axil opened this issue Jun 2, 2022 · 3 comments · May be fixed by #162
Open

RadioButton fires duplicate events on click #159

axil opened this issue Jun 2, 2022 · 3 comments · May be fixed by #162

Comments

@axil
Copy link
Contributor

axil commented Jun 2, 2022

from jupyter_bokeh import BokehModel
from bokeh.models import RadioGroup

def update(event):
    print(event)

LABELS = ["Option 1", "Option 2", "Option 3"]

radio_group = RadioGroup(labels=LABELS, active=1)
radio_group.on_click(update)

BokehModel(radio_group)

After a click on "Option 3" it displays:

image

I would expect the event to be fired only once (in javascript it fires once).

@bryevdv
Copy link
Member

bryevdv commented Jun 2, 2022

Does this happen only with BokehModel? If it happens in general, then this issue belongs in the main bokeh/bokeh repo.

@axil
Copy link
Contributor Author

axil commented Jun 2, 2022

from bokeh.plotting import figure, show, curdoc
from bokeh.models import RadioGroup

def my_radio_handler(new):
    print('Radio button option ' + str(new) + ' selected.')

radio_group = RadioGroup(labels=["Option 1", "Option 2", "Option 3"], active=0)
radio_group.on_click(my_radio_handler)

curdoc().add_root(radio_group)
bokeh serve --show myapp.py

Single call.

@axil axil linked a pull request Jul 7, 2022 that will close this issue
@axil
Copy link
Contributor Author

axil commented Jul 7, 2022

It turned out that all widgets are affected by this. I've made a quickfix. Plz have a look, @mattpap, maybe you'll find a better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants