Using an interactive text widget
Another interactive widget is a textbox. We using a text widget and gather changes as they occur in the box.
How to do it...
We can use this script:
def mytextfunction(x):
print(x)
return x
interactive_text = interactive(mytextfunction, x="Hello World")
interactive_textIt gives this display:

How it works...
Unexpectedly, the value changes on every keystroke you enter in the textbox, causing the printed display to mirror your typing.