So on the heels of my last question about button lag, I dug through the code base to find the following function:
@abstract
class AbstractGroup(Widget):
""" Abstract base class for all kinds of groups. ``AbstractGroup``
is not generally useful to instantiate on its own.
"""
labels = List(String, help="""
List of text labels contained in this group.
""")
def on_click(self, handler):
""" Set up a handler for button check/radio box clicks including
the selected indices.
Args:
handler (func) : handler function to call when button is clicked.
Returns:
None
"""
print "Button Clicked"
self.on_change('active', lambda attr, old, new: handler(new))
Clearly this function can be used to add functionality. Can someone please explain to me what “handler” is? How is it generated when a button is clicked?
Can I just call this function by inserting ButtonGroup.on_click() from the radiobuttongroup?
The handler argument is the python callback that you would like to have executed (in the server) whenever the button is clicked. It's a function that the user supplies, that the bokeh server will call whenever a button is clicked. it's typically only called once per widget, to "set things up". It's not completely out of the questions that one handler for one widget might call the on_click method on another, but it's not a typical use case. I'm not sure how to answer the last part, what is it exactly that you are wanting to accomplish (in terms of UI interaction that a user sees)?
So on the heels of my last question about button lag, I dug through the code base to find the following function:
@abstract
class AbstractGroup(Widget):
""" Abstract base class for all kinds of groups. ``AbstractGroup``
is not generally useful to instantiate on its own.
"""
labels = List(String, help="""
List of text labels contained in this group.
""")
def on_click(self, handler):
""" Set up a handler for button check/radio box clicks including
the selected indices.
Args:
handler (func) : handler function to call when button is clicked.
Clearly this function can be used to add functionality. Can someone please explain to me what "handler" is? How is it generated when a button is clicked?
Can I just call this function by inserting ButtonGroup.on_click() from the radiobuttongroup?
I would like write the state of the button to a variable. This way i can reference the variable and find out which radio button is clicked.
Im still trying to get around the problem that fast updates do not register the button active property change.
Also, is there a way to contribute functionality to bokeh?
···
Sent from my iPhone
On Mar 9, 2016, at 5:11 PM, Bryan Van de Ven <[email protected]> wrote:
Hi,
The handler argument is the python callback that you would like to have executed (in the server) whenever the button is clicked. It's a function that the user supplies, that the bokeh server will call whenever a button is clicked. it's typically only called once per widget, to "set things up". It's not completely out of the questions that one handler for one widget might call the on_click method on another, but it's not a typical use case. I'm not sure how to answer the last part, what is it exactly that you are wanting to accomplish (in terms of UI interaction that a user sees)?
So on the heels of my last question about button lag, I dug through the code base to find the following function:
@abstract
class AbstractGroup(Widget):
""" Abstract base class for all kinds of groups. ``AbstractGroup``
is not generally useful to instantiate on its own.
"""
labels = List(String, help="""
List of text labels contained in this group.
""")
def on_click(self, handler):
""" Set up a handler for button check/radio box clicks including
the selected indices.
Args:
handler (func) : handler function to call when button is clicked.
Clearly this function can be used to add functionality. Can someone please explain to me what "handler" is? How is it generated when a button is clicked?
Can I just call this function by inserting ButtonGroup.on_click() from the radiobuttongroup?
So you can do whatever you want with that value (assign it to another attribute or variable or whatever).
Im still trying to get around the problem that fast updates do not register the button active property change.
This will probably require some actual non-trivial investigation, which means the work will have to be prioritized. If there is not already a GH issue to track this, can you create one at Issues · bokeh/bokeh · GitHub
Also, is there a way to contribute functionality to bokeh?
Absolutely! We very much welcome new contributions and contributors. The project is hosted on GitHub, so contributions are usually made via GitHub Pull requests. If you need background on GH and PR's, there is an intro article here:
On Mar 9, 2016, at 5:11 PM, Bryan Van de Ven <[email protected]> wrote:
Hi,
The handler argument is the python callback that you would like to have executed (in the server) whenever the button is clicked. It's a function that the user supplies, that the bokeh server will call whenever a button is clicked. it's typically only called once per widget, to "set things up". It's not completely out of the questions that one handler for one widget might call the on_click method on another, but it's not a typical use case. I'm not sure how to answer the last part, what is it exactly that you are wanting to accomplish (in terms of UI interaction that a user sees)?
So on the heels of my last question about button lag, I dug through the code base to find the following function:
@abstract
class AbstractGroup(Widget):
""" Abstract base class for all kinds of groups. ``AbstractGroup``
is not generally useful to instantiate on its own.
"""
labels = List(String, help="""
List of text labels contained in this group.
""")
def on_click(self, handler):
""" Set up a handler for button check/radio box clicks including
the selected indices.
Args:
handler (func) : handler function to call when button is clicked.
Clearly this function can be used to add functionality. Can someone please explain to me what "handler" is? How is it generated when a button is clicked?
Can I just call this function by inserting ButtonGroup.on_click() from the radiobuttongroup?