I’m making an app that converts inches to millimeters.
If you look at the screenshot, it is inconvenient because the operation of entering a number, hitting the Enter key, deleting the existing number, and entering another number is repeated.
I was wondering how to make the input field blank before I press Enter and enter another number.
Is there a way to see the result rounded to 2 decimal places?
This method was discovered by chance,
My solution is ‘num = st.number_input(“”,value=1.0,format="%.1f ")’.
%f, %0.1d, %0.2f don’t matter.
The key is that you need a ‘space’ after the ‘f’.
This may be a coincidence, but for me it’s very useful.
When ‘space’ is removed, only the specified decimal point is kept and the rest is removed.