11import dash_html_components as html
2- < << << << HEAD
3- import dash_building_blocks as dbb
4-
5-
6- class OutputForm (dbb .Block ):
7-
8- def layout (self ):
9- return html .Div ([
10- html .Div (id = self .register ('output-state' ))
11- ])
12-
13- def callbacks (self , input_n_clicks , state_input1 , state_input2 ):
14-
15- @self .app .callback (
16- self .output ('output-state' , 'children' ),
17- [input_n_clicks ],
18- [state_input1 , state_input2 ]
19- )
20- def update_output (n_clicks , input1 , input2 ):
21- return u'''
22- The Button has been pressed {} times,
23- Input 1 is "{}",
24- and Input 2 is "{}"
25- ''' .format (n_clicks , input1 , input2 )
26-
27-
28- def initialize (app , data , fl ):
29-
30- output_form = OutputForm (app , data )
31-
32- fl .register_vis ('OutputForm' , output_form .layout )
33- fl .blocks .register ('output-form' , output_form )
34-
35- == == == =
362from dash .dependencies import Input , Output , State
373
4+
385def initialize (app , data , fl ):
39- > >> >> >> master
406
417 fl .register_vis ('OutputForm' , html .Div (id = 'output-state' ))
428
9+
4310def finalize (app , data , fl ):
44- < << << << HEAD
45-
46- fl .blocks ['output-form' ].callbacks (
47- fl .blocks ['input-form' ].input ('submit-button' , 'n_clicks' ),
48- fl .blocks ['input-form' ].state ('input-1-state' , 'value' ),
49- fl .blocks ['input-form' ].state ('input-2-state' , 'value' ),
50- )
51- == == == =
52-
11+
5312 @app .callback (Output ('output-state' , 'children' ),
5413 [Input ('submit-button' , 'n_clicks' )],
5514 [State ('input-1-state' , 'value' ),
@@ -60,4 +19,3 @@ def update_output(n_clicks, input1, input2):
6019 Input 1 is "{}",
6120 and Input 2 is "{}"
6221 ''' .format (n_clicks , input1 , input2 )
63- >> >> >> > master
0 commit comments