software trigger of a Button or Toggle on js side

Hi,
this is maybe not possible, bokeh is not fully bidirectional (?), but is there a way to perform a software trigger from python side to trigger the js callback ?

For instance with a Toggle, the python callback is called but not the js callback:

bb = Toggle()

bb.js_on_change(‘active’,CustomJS(code=""“console.log(‘clicked’);”""))

def bb_cb(attr,old,new): print(‘bb cb called’,attr,old,new)

bb.on_change(‘active’,bb_cb)

bb.active=True

I tried also update & trigger methods on bb. Not really knowing what i’m doing…no success

thx

Bokeh synchronizes property values bi-directionally. Having something like a (very lightweight) "RPC" mechanism is an open issue:

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

The best way to trigger JS code from python right now is probably to "fake it" e.g. you could add a bogus glyph that is invisible, and attach JS callbacks to some of its properties. Then to trigger the JS code from python you can change the property values (to whatever).

Thanks,

Bryan

···

On Apr 28, 2017, at 12:50, chupach <[email protected]> wrote:

Hi,
this is maybe not possible, bokeh is not fully bidirectional (?), but is there a way to perform a software trigger from python side to trigger the js callback ?
For instance with a Toggle, the python callback is called but not the js callback:

bb = Toggle()

bb.js_on_change('active',CustomJS(code="""console.log('clicked');"""))

def bb_cb(attr,old,new): print('bb cb called',attr,old,new)
bb.on_change('active',bb_cb)

bb.active=True

I tried also update & trigger methods on bb. Not really knowing what i'm doing...no success
thx

--
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/0a7a04e8-c4ff-4059-ba67-f71abf03689a%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.