0

I am new to Plotly Dash (Python). My question might be wrongly asked or naive, so please guide me in the right dirction if thats the case.

In my IDE, I have a dataframe library with a few hundred short texts. What I would like to do is to create an interface in which users see one piece of text per time and submit an (binary) input for this text (this needs to be saved in a new column/dataframe). Then, after they have given the input, a new short text will show for which they are asked to give their binary input again. These steps continue until all texts have been read.

Since I am new to Plotly, Dash, I don't know:

  • if this is possible

  • what type of functions I need to look for

  • how to write the code for this

So far, I have only found how to write a large piece of text:

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output

app = dash.Dash()

for text in library:
     markdown_text = text    
     app.layout = html.Div([
         dcc.Markdown(children=markdown_text)
     ])

if __name__ == '__main__':
    app.run_server(debug=True)

So any answer that gets me closer to implementation is welcome.

Ps. This answer is specifically focused on plots, so therefore not relevant to my question

1 Answer 1

1

I presume you have library which has your initial texts to display and a user input. Include an @app.callback with the user input value. Then the function for the callback can call the relevant text again from library and display in the div area of the layout.

Remember, you need to have id for all the elements on your page, so that callbacks can work correctly. Do refer to the examples given in dash documentation for callbacks.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.