adding button fuctionality - also, how to contribute functionality to the project?

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?

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)?

Bryan

···

On Mar 9, 2016, at 4:01 PM, RedRaven <[email protected]> wrote:

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?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5c16b08b-24f6-4641-891f-b60dcb35ee08%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan,

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)?

Bryan

On Mar 9, 2016, at 4:01 PM, RedRaven <[email protected]> wrote:

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?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5c16b08b-24f6-4641-891f-b60dcb35ee08%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/F3ACB0FD-322E-4BFC-9626-13D8CC9DD483%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan,

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.

If you attach a callback to a radio button, the callback gets passed the index of the active button(s) AFAIK, as shown in:

  https://github.com/bokeh/bokeh/blob/master/examples/models/buttons_server.py

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:

  About pull requests - GitHub Docs

If you are asking specifically about Bokeh development, there is a Developer's Guide here:

  Contribute — Bokeh 3.3.2 Documentation

Of course we are always happy to answer specific questions about making contributions here on the mailing list as well.

Thanks,

Bryan

···

On Mar 9, 2016, at 4:49 PM, Mail Lists <[email protected]> wrote:

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)?

Bryan

On Mar 9, 2016, at 4:01 PM, RedRaven <[email protected]> wrote:

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?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5c16b08b-24f6-4641-891f-b60dcb35ee08%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/F3ACB0FD-322E-4BFC-9626-13D8CC9DD483%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/46DDF4B8-C7D3-43D3-A78F-A087E2EAFA2C%40gmail.com\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.