Hey guys,
Unfortunately I was unable to find an answer here on the forum that could guide me.
I can create custom “Markdown HTML”, but I cannot capture the selection change.
The images are .png files of American and Brazilian flags, transformed into base64 to function as icons.
Please, can you tell me some way to achieve my goal?
Thanks for the directions.
But I had already read each of them and was unable to obtain or make adjustments to any of them in my code (which would produce the desired effect).
In the case of the ‘flags’ lib (which would ‘come closer to what is desired’) the icons relating to the ‘US’ and ‘BR’ flags, when rendered, appear only as strings and in the case of ‘GBENG’ a small black flag appears.
In this code example, the smiley icon that appears on the label was the type of effect I would like for radio buttons
import flag
st.radio('Test flag icon :smile:', (flag.flag('BR'), flag.flag('US'), flag.flag('GBENG') ))
Maybe I wasn’t able to correctly convey my objective in the initial post.
I would like to have just one flag icon (related to the dashboard’s language options) next to each radio button.
The ‘Mardown’ HTML that I created partially fulfills this proposal. I just can’t somehow detect the selection change.
(I even tried using js script and checked other posts here on the forum. They don’t seem to work within Streamlit)
I just saw something strange around here…
When I view this post on my smartphone the flags appear exactly as expected.
But on my computer the browser doesn’t display it the same way (it just shows string instead of the flag image).
The worst thing is that I tested it on 2 different browsers, Chrome Version 120.0.6099.225 (Official Build) 64-bit and MS Edge Version 120.0.2210.144 (Official Build) (64-bit)
The app shown above was implemented via st-lite and displayed in an iframe of the above forum post, and it seems to be causing issue for your access in a Chrome browser. However, have you tried to deploy the app and access it via your browsers.
I’ve tested by deploying the app and it seems to be working for me on the Chrome browser.
Hi @dataprofessor
Thanks for the tip, but as it’s still under development I haven’t deployed it yet.
As soon as I can I will try to deploy and see what happens.
I don’t know if it’s a valid deploy…
I did it by Streamlit/Github and get the same result as localhost
This is a print from a 3rd browser (Opera) in my desktop
As we can see I included the same code @blackary suggested together with mine and worked, except by no rendered flag icon
From my laptop, with a virtual machine using Ubuntu 22.04.3 LTS, with an updated version of Firefox before installing the indicated font, it was possible to see in the stLite editor (shared by @blackary), but it did not render in the panel on the side (mentioned earlier with a ‘security’ error detected by Firefox)
After installing the suggestion on the Ubuntu virtual machine, firefox stopped displaying the flags in the editor. Removing the suggestion went back to what it was before
On the Samsung S20FE/Andoid smartphone it continues to work normally with any of the above links.
Thanks for investigating further. It seems that the smartphone is the working option from the devices that you’ve tried. Could it be a proxy/internet connectivity issue? Can you try using your phone to share internet connection to your other device that you’ve tried previously to see if that changes anything.