I’m trying to display a text file on a call back.Its getting displayed but its formatting is changed.The spacing is very bad.But if i copy that same text and paste it in notepad its displaying properly.
html.Div(id=‘display-testrundata’, style={‘color’: colors[‘text’], ‘fontSize’: 16, ‘font-family’: “Lucida Sans Unicode”, ‘whiteSpace’: ‘pre-wrap’, ‘wordBreak’: ‘break-all’})
@app.callback(Output(‘display-testrundata’, ‘children’),
[Input(‘dropdown’, ‘value’),Input(‘date-picker-single’, ‘date’)])
def display_testrun(dropdown_value,displaydate):
with open(dropdown_value) as f:
displaytestrundata = f.read()
f.close()
#Below lines also give bad formating
#displaytestrun = codecs.open(dropdown_value, ‘r’, “utf-8”)
#displaytestrundata = displaytestrun.read().splitlines()
#displaytestrundata = ‘\n’.join(displaytestrundata)
#displaytestrun.close()
return displaytestrundata
This is how its displayed on my dash:
This is how its displaying if i copy same content onto a text file: