Button callback to select all checkboxes in CheckboxGroup does not work in Python 2.7.12
See original GitHub issueALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)
Browsers:
- Firefox 53.0 (32-bit)
- Chrome Version 58.0.3029.81 (64-bit)
Python:
Python 2.7.12
bokeh 0.12.5
OS: Windows 10 Pro 64-bit
Description of expected behavior and the observed behavior
Create a button to toggle a checkbox group (selecting and unselecting all checkboxes on button click).
Does not work on Python 2.7.12
with bokeh 0.12.5
Complete, minimal, self-contained example code that reproduces the issue
from bokeh.io import show
from bokeh.layouts import widgetbox, row
from bokeh.models.widgets import Button, CheckboxGroup
from bokeh.plotting import curdoc, output_file
output_file("states.html", title="states")
states_list = ["Alabama", "Alaska ", "Arizona", "Arkansas", "California",
"Colorado", "Connecticut", "Delaware", "Florida", "Georgia",
"Hawaii", "Idaho ", "Illinois", "Indiana", "Iowa", "Kansas",
"Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts",
"Michigan ", "Minnesota", "Mississippi", "Missouri", "Montana",
"Nebraska", "Nevada ", "New Hampshire", "New Jersey",
"New Mexico", "New York", "North Carolina", "North Dakota",
"Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island",
"South Carolina", "South Dakota", "Tennessee", "Texas", "Utah",
"Vermont", "Virginia", "Washington", "West Virginia",
"Wisconsin", "Wyoming"]
states = CheckboxGroup(
labels=states_list,
active=[0, 1])
def update():
states.active = list(range(len(states_list)))
select_all = Button(label="select all")
select_all.on_click(update)
group = widgetbox(select_all, states)
layout = row(group)
curdoc().add_root(layout)
curdoc().title = "states"
show(layout)
Source: http://stackoverflow.com/a/39562653/295246
Stack traceback and/or browser JavaScript console output
No traceback and nothing of significance in the JS Console output.
Screenshots or screencasts of the bug in action
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Bokeh widget callback to select all checkboxes - Stack Overflow
The basic function of the Bokeh server is to keep all Bokeh objects in sync on both the Python and JS sides. The...
Read more >Defining a JavaScript callback from a button to select all ...
I want to do now is to have two buttons, for selecting all and for clearing all, checkbox selections. The code above has...
Read more >tkinter checkbox - Python Tutorial
checkbox. tkinter checkbox. The tkinter checkbox widget is a very basic switch. A checkbox in tkinter is named a CheckButton. You can add...
Read more >Checkbox - Chakra UI
Checkbox component is used in forms when a user needs to select multiple values from several options.
Read more >Add GUIs to your programs and scripts easily with PySimpleGUI
What if it were so easy to open a Python program into a GUI that ... Button callbacks are handled by PySimpleGUI, not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@DuCorey thanks for the good catch, I agree that this now seems like a usage error. (I missed also the
show
call in in the code sample). I did fire up a VM to test this and when run as a bokeh app (i.e. not with justpython test.py
) things work:So I’m going to go ahead and close this. @cbdelavenne if you believe this is in error please re-open with additional information.
@cbdelavenne thanks for the extremely detailed report! We will look at things as soon as we can (hopefully something simple). I’ve marked this as
plat:windows
for now as this code works for me on OSX