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

Make pn.depends and pn.interact accept widgets #639

Merged
merged 6 commits into from Sep 10, 2019
Merged

Conversation

jsignell
Copy link
Member

@jsignell jsignell commented Sep 9, 2019

Closes #638

These all work now:

ticker = pn.widgets.Select(name='Ticker', options=tickers)
window = pn.widgets.IntSlider(name='Window Size', value=6, start=1, end=21)

@pn.depends(ticker, window)
def get_plot(ticker, window_size):
    df = get_df(ticker, window_size)
    return df.hvplot.line('date', 'close', grid=True)

pn.Row(
    pn.Column(title, ticker, window),
    get_plot
)
pn.interact(get_plot, ticker=ticker, window_size=window)
pn.interact(get_plot, ticker=ticker.param.value, window_size=window.param.value)

@jsignell jsignell self-assigned this Sep 9, 2019
@jsignell
Copy link
Member Author

jsignell commented Sep 9, 2019

I haven't fixed all the examples or written tests, just wanted to check with @philippjfr that this seems sane and helpful.

@philippjfr
Copy link
Member

It looks like you didn't push the depends.py module.

panel/interact.py Outdated Show resolved Hide resolved
@jsignell
Copy link
Member Author

I don't really think there is any value in interact accepting widget.param.value in addition to widget, so I got rid of all the changes in interact

@philippjfr philippjfr merged commit d7a39c5 into master Sep 10, 2019
@jbednar jbednar deleted the jsignell/widgetize branch September 10, 2019 14:17
philippjfr added a commit that referenced this pull request Oct 3, 2019
* Make interact and depends accept widgets

* Simplifying APIs example

* Adding the depends file

* Get rid of duplicate widget handling in interact

* linting

* Make python2 compatible

Co-Authored-By: Philipp Rudiger <prudiger@anaconda.com>
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

Successfully merging this pull request may close these issues.

Add pn.panelize or at least improvements to pn.depends
2 participants