Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

Programmatically update parameter value does not update widget #82

Open
suyang-nju opened this issue Apr 28, 2018 · 1 comment
Open
Assignees

Comments

@suyang-nju
Copy link

See the following code. xystream.event(y=-0.3) updates y value to -0.3, but the slider widget is not updated accordingly.

from holoviews.streams import Stream
import param
import paramnb

class XY(Stream):
    x = param.Number(default=0.0, bounds=(-0.5, 0.5))
    y = param.Number(default=0.0, bounds=(-0.5, 0.5))

    def event(self, **kwargs):
        super(XY, self).event(**kwargs)
        print(self.contents)

xystream = XY()
paramnb.Widgets(xystream, callback=xystream.event, on_init=True)

# does not update y slider
xystream.event(y=-0.3) 
@suyang-nju
Copy link
Author

Solved by doing

w = paramnb.Widgets.instance()
w(xystream, callback=xystream.event, on_init=True)
w.widget('y').value = xystream.contents['y']

Not sure if this is the right way to do it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants