I want to add numbers (including negatives) displayed in a column widget.
How to align them with respect to the decimal points?
Any other widget or tricks to align them?
Thanks.
I want to add numbers (including negatives) displayed in a column widget.
How to align them with respect to the decimal points?
Any other widget or tricks to align them?
Thanks.
2
Answers
To align numbers, including negatives, with respect to the decimal points in a column widget, you can use the
Text
widget along with theTextAlign
property. TheTextAlign
property allows you to control the horizontal alignment of the text within the widget.Keep in mind that this approach will align the numbers based on the decimal points. If you have numbers with varying decimal places, the decimal points will be aligned, but the whole numbers may not be perfectly aligned
Example using the
Table
widget:you need convert number to string, and split string by decimal points, here is my demo code.