Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ipytangle to plug and play with interactive #8

Closed
tonyfast opened this issue Jun 9, 2015 · 2 comments
Closed

Allow ipytangle to plug and play with interactive #8

tonyfast opened this issue Jun 9, 2015 · 2 comments

Comments

@tonyfast
Copy link

tonyfast commented Jun 9, 2015

The widgets needs value to automatically update the backbone model; it also needs a description. Can ipytangle be easier to plug into interact and interactive?

@bollwyvl
Copy link
Owner

bollwyvl commented Jun 9, 2015

Going from interact into tangle is reasonable: once you define an @interact function, you get back a function which has a .widget member (tuple though, yuck).

Here's an example.

In the other direction, adding a value and description is doable, but i guess passing a tangle straight up would mean a pointer to itself so that you still got back the tangle instance...

t = tangle(x=1)
@interact(t=t)
def foo(t):
    print(t.x + 1)

i'd have to figure out how to trigger the change of value on any change on any user-defined traitlet, but that should be okay if it doesn't cause an infinite loop.

As part of #3, i'll end up building widgets to represent all of the traitlets that get created (or reuse ones if a widget value itself is given). that might make this easier, as you could ask for

t = tangle(x=1)
@interact(x=t.widget.x)
def foo(x):
    print(x+1)

@tonyfast
Copy link
Author

tonyfast commented Jun 9, 2015

That example notebook was super helpful. Thanks.

Here is a demo with Bokeh. In this demo, I was unable to find a way to pass the trig function to tangle.

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

No branches or pull requests

2 participants