Progress Bar Help

Hi guys!

I’m needing some help with the progress bar widget. I am currently trying to use the indeterminate bar and am having troubles making it turn on and off based on an action parameter (Button).

Here is my code, I’m wanting the bar active to be set to True while the function get_final_dataframes is running (usually about 20 sec) and then active to be set to false when it is done.

I have tried to do self.indeterminate.active = True before the function call, and self.indeterminate.active = False after the function call but that does not seem to work.

calculate = param.Action(lambda x: x.param.trigger('calculate'), label='Calculate')

indeterminate = pn.widgets.Progress(name='Indeterminate Progress', active=False, width=200)

@param.depends('calculate', 'date_select', watch=True) # What occurs when calculate is clicked on
def handler(self):
    self.shares_to_buy, self.shares_to_sell, self.rebalanced_df, self.apex_buys, self.apex_sells = get_final_dataframes()
    print("Tables Updated\n")
calculate = param.Action(lambda x: x.param.trigger('calculate'), label='Calculate')

indeterminate = pn.widgets.Progress(name='Indeterminate Progress', active=False, width=200)

@param.depends('calculate', 'date_select', watch=True) # What occurs when calculate is clicked on
def handler(self):
    self.indeterminate.active = True
    self.shares_to_buy, self.shares_to_sell, self.rebalanced_df, self.apex_buys, self.apex_sells = get_final_dataframes()
    self.indeterminate.active = False
    print("Tables Updated\n")