Read updated textfile

I have just started to use Dash. My final goal is to develop a dashboard to simulate buildig energy and exchange CAD data but right now I just trying to read data from a local textfile that is being updated one per second. The examples I found at contains so many aspects so I wonder if someone could help me with an simple example, just reading data once per second and visualize this on a page.


This is a well paced tutorial (though a little outdated, go back to the official documentation after it to check out the new features) that probably includes most the stuff you want:

1 Like

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, Event, State
import os
path1 = os.path.join(’/Users/giovannicruz/Documents/’, ‘Storm2018.txt’)

app = dash.Dash(name)

app.layout = html.Div(style={‘backgroundColor’: ‘white’, ‘color’: ‘black’}, children=[

                                    id = 'text-input',
                                    placeholder = '', style= dict(display = "none"),
                                    type = 'text',
                                    value = ''),
                            html.Div(id = 'text-display'),

                                             interval = 1000)

events=[Event(‘text-interval’, ‘interval’)])
def update_text_output_2(input_value):
with open(path1, ‘r’) as Texlist1:
content =
return content

if name == “main”:

1 Like