-
-
Notifications
You must be signed in to change notification settings - Fork 527
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
Proposal to add context managers to all Layouts + Templates #6712
Comments
Maybe it can be useful for BooleanIndicators too. processing = pn.indicators.BooleanStatus(value=False)
try:
processing.value = True
...
finally:
processing.value = False with processing:
... |
Ah Philipp mentioned that we could simply use import time
import panel as pn
pn.extension()
layout = pn.WidgetBox(pn.widgets.TextInput(), pn.widgets.Button(name="Click me!"))
layout I think there's no need for this proposal then!
I think the only need is to document this in the Best Practices guide eventually. |
I have also seen context_managers pn.config.set and .set_values. Would be Nice to align on .update to reduce What you need to remember. |
|
Inspired by @MarcSkovMadsen's comment #6617 (comment)
Many times, I find myself doing something like:
I'm wondering whether we can simplify it:
For templates, it'd be the same:
I think this would work with all layouts, except maybe Swipe (which I think is more fitting to be a Pane).
Additionally, for a future
pn.StatusCard
(or currentlypn.chat.ChatStep
), I imagine it would also update thestatus
param onfinally
.The text was updated successfully, but these errors were encountered: