Button redirects to http://localhost:5006/? when pressed

Hi!

Using a bokeh serve as the backend for my script with buttons incorporated as follows

		smoothing_button = Button(label = "smth selct elem")

		smoothing_button.on_click(lambda identity = self.attribute_ids[i], radio = radio_group,

									x_box = text_input_xval_integral, y_box = text_input_yval_integral:

								self.smoothing(identity, radio, x_box, y_box) )

(the lambda function is to capture context because I’m generating quite a lot of plots.)

the callback itself is fairly simple, it just computes an exponential moving average on the selected curve:

	element = radio.labels[radio.active]

	lower_xdelim = float(x_box.value)

	lower_ydelim = float(y_box.value)

	source_local = getattr(self, attrname+"_"+element+"_source")  #attr_id+"_"+dataset["sample element"]+"_source"

	x = np.array(source_local.data["x"])

	y = np.array(source_local.data["y"])

	alpha = 0.5 #some number between 0 and 1, needs be adjusted

	s1 = y[0]

	ema = np.zeros(len(y))

	ema[0] = s1

	j = 1

	for val in y[1:]:

		ema[j] = alpha * val + (1-alpha) * ema[j-1]

		j += 1

	source_local.data = dict(x = x, y = ema, element = [element for i in range(len(x))])

Which works as intended, with the caveat that when I press the button I get redirected to http://localhost:5006/?, pressing backspace takes me to the bokeh session I was working on with the updated plot. Inspecting the button object it seems alright (to me atleast):

smth selct elem

Any idea what’s going on here?

This issue was recently fixed in master:

  https://github.com/bokeh/bokeh/issues/3895

And We should have an easily installable dev build soon.

Bryan

···

On Mar 30, 2016, at 7:50 AM, Robert <[email protected]> wrote:

Hi!

Using a bokeh serve as the backend for my script with buttons incorporated as follows

      smoothing_button = Button(label = "smth selct elem")
      smoothing_button.on_click(lambda identity = self.attribute_ids[i], radio = radio_group,
                    x_box = text_input_xval_integral, y_box = text_input_yval_integral:
                  self.smoothing(identity, radio, x_box, y_box) )

(the lambda function is to capture context because I'm generating quite a lot of plots.)

the callback itself is fairly simple, it just computes an exponential moving average on the selected curve:

    element = radio.labels[radio.active]

    lower_xdelim = float(x_box.value)
    lower_ydelim = float(y_box.value)

    source_local = getattr(self, attrname+"_"+element+"_source") #attr_id+"_"+dataset["sample element"]+"_source"

    x = np.array(source_local.data["x"])
    y = np.array(source_local.data["y"])

    alpha = 0.5 #some number between 0 and 1, needs be adjusted

    s1 = y[0]
    ema = np.zeros(len(y))
    ema[0] = s1
    j = 1
    
    for val in y[1:]:
      ema[j] = alpha * val + (1-alpha) * ema[j-1]
      j += 1

    source_local.data = dict(x = x, y = ema, element = [element for i in range(len(x))])

Which works as intended, with the caveat that when I press the button I get redirected to http://localhost:5006/?, pressing backspace takes me to the bokeh session I was working on with the updated plot. Inspecting the button object it seems alright (to me atleast):

               <button class="bk-bs-btn bk-bs-btn-default">smth selct elem</button>

Any idea what's going on here?

--
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/304d364e-d2b2-4631-973f-c4b38917bc53%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Fantastic, I had a vague memory of this being the case. Thanks!

···

2016-03-30 18:24 GMT+02:00 Bryan Van de Ven [email protected]:

This issue was recently fixed in master:

    [https://github.com/bokeh/bokeh/issues/3895](https://github.com/bokeh/bokeh/issues/3895)

And We should have an easily installable dev build soon.

Bryan

On Mar 30, 2016, at 7:50 AM, Robert [email protected] wrote:

Hi!

Using a bokeh serve as the backend for my script with buttons incorporated as follows

                  smoothing_button = Button(label = "smth selct elem")
                  smoothing_button.on_click(lambda identity = self.attribute_ids[i], radio = radio_group,
                                                                          x_box = text_input_xval_integral, y_box = text_input_yval_integral:
                                                                  self.smoothing(identity, radio, x_box, y_box) )

(the lambda function is to capture context because I’m generating quite a lot of plots.)

the callback itself is fairly simple, it just computes an exponential moving average on the selected curve:

          element = radio.labels[radio.active]
          lower_xdelim = float(x_box.value)
          lower_ydelim = float(y_box.value)
          source_local = getattr(self, attrname+"_"+element+"_source")  #attr_id+"_"+dataset["sample element"]+"_source"
          x = np.array(source_local.data["x"])
          y = np.array(source_local.data["y"])
          alpha = 0.5 #some number between 0 and 1, needs be adjusted
          s1 = y[0]
          ema = np.zeros(len(y))
          ema[0] = s1
          j = 1
          for val in y[1:]:
                  ema[j] = alpha * val + (1-alpha) * ema[j-1]
                  j += 1
          source_local.data = dict(x = x, y = ema, element = [element for i in range(len(x))])

Which works as intended, with the caveat that when I press the button I get redirected to http://localhost:5006/?, pressing backspace takes me to the bokeh session I was working on with the updated plot. Inspecting the button object it seems alright (to me atleast):

           <button class="bk-bs-btn bk-bs-btn-default">smth selct elem</button>

Any idea what’s going on here?

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/304d364e-d2b2-4631-973f-c4b38917bc53%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/az8KMaUCoEo/unsubscribe.

To unsubscribe from this group and all its topics, 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/383D6D91-C4E3-470A-8169-27AC2CDF3353%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.