Using rendered .svg files within st.selectbox

Hello dear Community,

This is my first post ever here - I hope, Iโ€™m doing this right.

I was wondering, if itโ€™s possible to use rendered svg files together with string values inside the st.selectbox function ?

For example, when using st.stelectbox to choose a country, show the options with a svg file of the actual flag of the country and the country name by string. Such as: {flag.svg} - {country-string}

Thank you very much in advance to everyone!
Marvin

In the case of flags, you could use emojis instead of reading the flag images.

import streamlit as st

countries = ["๐Ÿ‡บ๐Ÿ‡ธ USA", "๐Ÿ‡ซ๐Ÿ‡ท France", "๐Ÿ‡ฏ๐Ÿ‡ต Japan"]
option = st.selectbox("Pick a country", countries)
f"**You picked {option}**"
2 Likes

Hey there,

Thank you for your reply!

Thatโ€™s definitely a cool workaround for the flag specific case, however, Iโ€™d also like to use this for other images / icons / .svgs

Do you have any idea how I could do that ?

Thank you still for your help, really appreciate it!

Cheers,

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