Do served panel components act differently to inline rendered components?

26 Views Asked by At

I am currently developing a panel application to perform some data analysis on csv files. I have a button which imports the csv data into the application, this button changes colour and style depending on the state of the import. When rendering the button inline in jupyter, the button changes how I would expect it to. When the button is being served in the panel app, it seems like the order of the function is incorrect, as if python is performing the sleep first and then all of the panel value updates. The included gif is of the difference in button action.

The difference in outcome I am experiencing

if files is None:
    unitprint.value='No units found'
    btn_test_func.name='Please select a file...'
    btn_test_func.button_style='solid'
    btn_test_func.button_type='warning'
    btn_test_func.disabled = True
    time.sleep(2.5)
    btn_test_func.disabled = False
    btn_test_func.name='Import File '
    btn_test_func.button_style='outline'
    btn_test_func.button_type='success'

This is an example of the if statement that is run when the button is clicked. 'files' is the variable that the file selector value is being assigned to so in this case if there is no file selected it asks the user to select a file and then returns to its default state. I have searched online for information on holoviz functions and whether it may not be respecting the order of the function correctly, but it seems like that shouldn't be the case. I have tried changing the sleep time to see if the app was lagging and the sleep was being done but the visual components were taking a while to update but the time.sleep() is definitely being done first and then the components are updating.

0

There are 0 best solutions below