can any help me how to do this??
Thanks in advance.
can any help me how to do this??
Thanks in advance.
The box can be a html.Div
which you target as the output of a callback. The callback would retrieve the values and display them. The callback could be triggered either by values changing if they are coming from the frontend, or by a dcc.Interval
if you want to periodically update the values. See https://dash.plot.ly/live-updates for more on that.
Hi @bhanu8 - I wonder if this is the same question you sent a DM about - it’s better to keep these discussions public so everyone can help (and benefit from the answers) so I’ll re-ask and answer it here, since it looks similar. The DM:
hey hi this is bhanu can you please help me how to create a list box which will read my excel data and just show in that list box and when the data changes then the list box should get updated .
I would approach this problem something like this:
dcc.Interval
component to check for updates, a dcc.Store
component with storage_type='local'
to hold the modification time of the file, and a dcc.Dropdown
to hold your results.n_intervals
prop as Input
and the store’s data
as State
, and returns both the dropdown’s options
and the store’s data
as Output
.dash.exceptions.PreventUpdate
. Otherwise, read your excel file and convert it to options
, then return both the options
and the modification time for the store’s data
.Hope that helps!
Thanks for your reply, but Alex I don’t need a dropdown I need a normal list box which just print the cells of my excel in the box.
OK, so don’t make a Dropdown
to hold the results, perhaps a dash_table.DataTable
, or dcc.Checklist
or dcc.RadioItems
?
You can make any HTML elements you want, so if you really want a traditional list box you can do it, make a html.Div
element and have the callback connect to its children
prop, and return something like
html.Select([html.Option(v) for v in values], size=20)
(assuming you’ve read your excel file into a values
list). Be aware though that we have not created event handlers for html.Select
, so you wouldn’t be able to read back out the items the user chooses. If you need that, I’d suggest one of the options above.