Skip to content

Commit

Permalink
update README example for Dash 2.0 and Dash.jl 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed Nov 1, 2021
1 parent 5dc7d5d commit 7ac2cd0
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ pip install dash dash-textarea-autocomplete
```py
# usage.py
import dash_textarea_autocomplete
import dash
from dash.dependencies import Input, Output, State
import dash_html_components as html
from dash import Dash, callback, html, Input, Output, State

WORD_LIST = ['apple', 'application', 'apartment',
'boat', 'banana', 'boss',
'coast', 'code', 'cat']

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app = Dash(__name__, external_stylesheets=external_stylesheets)

app.layout = html.Div([
dash_textarea_autocomplete.DashTextareaAutocomplete(
Expand All @@ -49,15 +47,15 @@ app.layout = html.Div([
], className='container')


@app.callback(Output('output', 'children'),
Input('input', 'value'))
@callback(Output('output', 'children'),
Input('input', 'value'))
def display_output(value):
return 'You have entered: {}'.format(value)


@app.callback(Output('output2', 'children'),
Input('btn', 'n_clicks'),
State('input', 'value'))
@callback(Output('output2', 'children'),
Input('btn', 'n_clicks'),
State('input', 'value'))
def display_output2(n_clicks, value):
return 'After click, you have: {}'.format(value)

Expand All @@ -70,11 +68,11 @@ if __name__ == '__main__':

### Dash for Julia

1. Install `DashTextareaAutocomplete.jl`, `Dash.jl` and `DashHtmlComponents.jl`:
1. Install `DashTextareaAutocomplete.jl` and `Dash.jl`:

```jl
pkg> activate .
pkg> add Dash DashHtmlComponents DashTextareaAutocomplete
pkg> add Dash DashTextareaAutocomplete
```

2. Run `julia --project usage.jl` - [click here to see `usage.jl`](https://github.com/etpinard/dash-textarea-autocomplete/blob/main/usage.jl)
Expand Down

0 comments on commit 7ac2cd0

Please sign in to comment.