A callback function in bokeh usually has three arguments: attr, old, and new as shown in this example in the documentation
def my_text_input_handler(attr, old, new):
print("Previous label: " + old)
print("Updated label: " + new)
text_input = TextInput(value="default", title="Label:")
text_input.on_change("value", my_text_input_handler)
My questions are:
- Why isn't
attrused inside the body of the functionmy_text_input_handler? What (attr) is it actually? - What is the parameter
"value"in the methodtext_input.on_change("value"...)? - After running the curdoc(), a text box with a value ("default") was displayed. I then changed that value ("default") to "test", nothing was printed out whilst I thought 2 sentences "Previous label: default" and "Updated label: test" would be produced.
Thank you.