有没有Python函数可以刷新dash应用程序



线程每小时更新一次数据。我希望Dash应用程序在线程启动和线程结束时自动刷新。(就像网络浏览器中的按钮(

class RemplisseurDB(Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
while True:
global layout_mess
layout_mess = 0
global dfusin
dfusin = pd.read_excel('pathPlanning Usinage.xlsm', sheet_name='Interface_Data')
now = datetime.now()
end = datetime(now.year,now.month,now.day,now.hour + 1 ,0,0)
self.attente = (end - now).seconds
layout_mess = 1
time.sleep(self.attente)

def affich():
if layout_mess == 0:
return html.Div(children=[
html.H2(id='update0',children='Update in progress, please wait few minutes ....')])`
else:
return html.Div([
html.H2(id='update1',children='work space')])`

app.layout=affich

我发现了这个Dash组件,它似乎符合您的需求https://dash.plotly.com/live-updates

最新更新