Hi there,
is there a way to force a new line in the label of the radio widget? This doesn’t work:
vis_outliers= st.radio(
'Display outliers?\n(for data that might have errors only)',
['no', 'yes', 'hidden']
)
Thanks for your help.
Hi there,
is there a way to force a new line in the label of the radio widget? This doesn’t work:
vis_outliers= st.radio(
'Display outliers?\n(for data that might have errors only)',
['no', 'yes', 'hidden']
)
Thanks for your help.
Hi, how about doing this as an alternative:
OR
AND
Hi Shawn,
thanks for your response. Unfortunately \n
doesn’t seem to work in st.text(
either. Your second suggestion kind of works, but the spacing between the lines and between the text and the radio buttons gets too big (I have a little bit of OCD when it comes to formatting ).
I guess I’ll stick with having everything in one line.
Thanks anyway.
Hi @lasinludwig , there’s another thing you can try. Check the code below:
import streamlit as st
sc1, sc2 = st.columns((1,7))
with sc1:
st.caption(“With wrap”)
vis_outliers= st.radio(
‘Display outliers?\n(for data that might have errors only)’,
[‘no’, ‘yes’, ‘hidden’], key=“a”)
with sc2:
st.caption(“Without column wrap”)
vis_outliers= st.radio(
‘Display outliers?\n(for data that might have errors only)’,
[‘no’, ‘yes’, ‘hidden’], key=“b”)
Cheers
I don’t think this would work. If I understand this code correctly, you put the radio menu in a very narrow column. This wouldn’t allow you to define the position of the new line though. As far as I know the column width is connected to the window size of the browser. Also, since the second line of the text is longer than the first, you would get a line break in the second line as well…
Hi @lasinludwig ,
I’ll explain differently:
Yes, in my code, I adjusted the column width to simulate a wrap to 2 lines, because individual writes would have given you a larger vertical gaps.
You won’t be able to micro-adjust as with some other programming languages.
Hope that’s understandable.
Anyway, I think you have already figured out a different solution.
Cheers
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.