Click Button without refreshing while the app is still running

Hi everybody
I am building an app for local usage only.
I am using ‘os.system()’ for running my workflow via linux command lines
It’s only for allowing my colleges to run bioinformatics programs using a nice interface.
The output is saved in local directories.
A step of the workflow is dna reads QC. The output is saved in a local directory in html format.
I would like to create a button to display the render fot each sample:

My problem is I can’t use ‘st.button’ because I don’t want the page refreshed after each click, and I want the user be able to see the output of a sample while the app still running the workflow (it can be a very very long workflow), in order to know if letting the app running or aborting it.

So I tried with the 'st.markdown:

        <button onclick= "{} " > Open </button>
        """, unsafe_allow_html=True   

The problem is the function is launched when the widget is created, without any click.

I will appreciate your precious help

Thank you!

Hey @Dav,

Thanks for sharing your question!

Not sure if this would work for your use case, but one way to avoid the app rerunning after interacting would be to use a checkbox instead of a button, and to have that checkbox be part of a form, which allows you to batch input widgets and prevent the app from rerunning until the user clicks the submit button.

Normally I’d also suggest session state or caching, but it sounds like you have another function running at the same time that you want the user to click the button or checkbox, so those might not be the right fit (since the app as a whole would still rerun – you would just prevent the rerun of specific pieces of code).

Hi Caroline,
Thank you very much for your reply.
It is doesn’t work in this case because I don’t want a submit button.
I don’t think it is possible to do.
But still, the tool is great !

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.