How to link a text_area to a button

Hello,
In my app I have a st.text_area() where the user enters a DNA sequence. As it is now the user must press “Ctrl+Enter” after pasting the sequence in the text_area widget for the app to process the user’s sequence.
I would like to add a “Compute” button, to make the app more user-friendly/foolproof.
Is there a way to add this functionality to a st.button()?
Thanks in advance!

maybe something like this?

button=st.button('Hit me')
if (button==True):
  st.write('run calculation') ! replace with your function
2 Likes

It works, thank you!

3 Likes