Reloading image after getting the value
I use the clicked coordinates to display points on the image. However, currently the image is being displayed before I get the "value" and I have to reload the script in order to show changes on the image. This leads to a very annoying flickering after each click. It would be nice to have an option to update the image immediately after acquiring the coordinate values.
Just to clarify. Ideally, one should avoid using "st.rerun()" to update the image, because it flickers and the whole experience looks unprofessional. Cannot you use e.g. st.empty() in the module to clear and refresh the image?
I have an idea how to solve this. You could update image URL in this method by simply adding "?salt=<random_number>" into the following method: https://github.com/blackary/streamlit-image-coordinates/blob/1ecfe31d4fd6e05508f2673c810cdaa779ae23e1/src/streamlit_image_coordinates/frontend/main.js#L16
This would force the browser to reload the image every time user click on it and load the newest version.
+1 on this. Using st.rerun works as mentioned here, but it's very annoying to use as the screen flickers on very click
@blackary, Is it possible to add an on_click callback parameter to streamlit_image_coordinates() that somehow provides access to coordinates as well?
Yes, if we're willing to limit to streamlit>=1.36.0, custom components can have an on_change, which seems like a good idea to me. It would make this problem much simpler to solve.