question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Button callback to select all checkboxes in CheckboxGroup does not work in Python 2.7.12

See original GitHub issue

ALL 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

select_all_bokeh

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bryevdvcommented, Jul 11, 2017

@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 just python test.py) things work:

screen shot 2017-07-11 at 12 49 46

So I’m going to go ahead and close this. @cbdelavenne if you believe this is in error please re-open with additional information.

1reaction
bryevdvcommented, May 1, 2017

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found