Modal text input component


For those interested, I’ve designed a ‘modal’ text input widget.

‘modal’ meaning that the python script actually pauses until the widget returns an output string.

You can thus do things like:

txt=modal_input("Enter text here")
#waits until txt is returned from the front-end
#prints the input text immediately without needing a rerun

This is made possible by leveraging firestore as a direct means of communication between backend and frontend. (You need a firebase account and a firestore database setup to use it)

More info in the repo.

Using firestore is quite an arbitrary design choice, as you could use any other instant messaging service API to achieve the same result. Just fork the repo and adapt the logic to your specific needs, but it gives a working starting point.