Hi all -
I want to create a hyperlink in streamlit and upon clicking, need to invoke a python function. I know, I can do it via., a button. Can the same achieved by Hyperlink ?
st.markdown(f"check out this link")
Hi all -
I want to create a hyperlink in streamlit and upon clicking, need to invoke a python function. I know, I can do it via., a button. Can the same achieved by Hyperlink ?
st.markdown(f"check out this link")
Hi @MrittiYogan,
Thanks for posting!
You can do the following:
url = "https://www.streamlit.io"
st.write("check out this [link](%s)" % url)
st.markdown("check out this [link](%s)" % url)
Caroline
Thanks for the response. URL works. But I need to call a python function while someone clicks the link.
Hi @MrittiYogan,
What you’re looking for is the callback function via on_change
or on_click
that allows you to execute a Python function upload interaction with an input widget. As you have recalled, st.button
supports callback and works in your case while st.write
or st.markdown
does not have a callback function and would not work. At the moment, st.button
seems to allow what you’re looking for.
Hope this helps.
Hi Chanin, I want to use markdown to show the text along with the link. The solution shared above by Caronline works however what I am looking for is the text must be centered.
Which function will allow me to do that?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.