The below code will show and then hide the LoadingSpinner indicator under Panel V 1.2.0, but under Panel 1.2.1, the LoadingSpinner is never shown
When creating a widget with visible=False, setting .visible to True doesn’t reveal the widget. The below code works under panel v 1.2.0 as expected - it reveals the spinner, sleeps for 5 seconds, and then hides the spinner. Looking at the javascript console when the script is executed under panel v1.2.0, the css style “:host { display: none !important; }” is applied at the start, is removed when I click the submit button and .visible is set to true, and then added back once .visible is set to false
import panel as pn
import logging
import bokeh
import time
logger = logging.getLogger('panel.tifviewer')
pn.extension(sizing_mode='stretch_width') #stretch_width
pn.__version__
load_and_display_spinner = pn.indicators.LoadingSpinner(value=False, height=100, width=100, visible=False)
submit = pn.widgets.Button(name='submit', button_type='primary')
main_ui = pn.Column(
pn.Row(
pn.pane.Markdown(f'## my panel version is {pn.__version__}'),
),
pn.Row(
submit
),
pn.Row(
load_and_display_spinner
),
)
tabs = pn.Tabs(
('app', main_ui),
).servable()
def load_display(spinner, x):
print(f"spinner is {spinner}")
print(f'switch is {x}')
if (x == 'on'):
spinner.value = True
spinner.visible = True
if (x == 'off'):
spinner.value = False
spinner.visible = False
def do_some_task(event):
load_display(load_and_display_spinner, 'on')
time.sleep(5)
load_display(load_and_display_spinner, 'off')
submit.on_click(do_some_task)