rsalmei / alive-progress

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
MIT License
5.53k stars 206 forks source link

Commas in the numbers? #240

Closed xevg closed 1 year ago

xevg commented 1 year ago

Is there a way to put commas into the number? I tried passing in a formatted string as monitor, but that didn't work.

rsalmei commented 1 year ago

I didn't quite get what you're asking. Please send some code example of what you tried, so I can help you.

rsalmei commented 1 year ago

Well, I'm closing this. Please reply if still needed.

xevg commented 1 year ago

I apologize, I did not see your original reply. I simply mean I would like the numbers to be 1,234,567 instead of 1234567. When dealing with large number of loops, it’s easier to see where it is with those indicators.

rsalmei commented 1 year ago

Hey, no problem.

Humm, now I got it. That's kinda tricky actually, because of internationalization/locale issues. I can try to find out what Python provides in this regard.

rsalmei commented 1 year ago

Oh, have you seen my latest version, which supports SI scaling? In this mode the comma/dot does appear, together with a prefix like k or M. Wouldn't that work for you? If you're dealing with such large numbers, the scaling should make them much more friendly.

xevg commented 1 year ago

It might. Is there any more documentation on the scale and precision? I don't know what SI, IEC, SI2 are.

TheTechRobo commented 1 year ago

@xevg I think the prefixes used are here: https://en.wikipedia.org/wiki/Binary_prefix

See the sidebar:

image

rsalmei commented 1 year ago

It might. Is there any more documentation on the scale and precision? I don't know what SI, IEC, SI2 are.

Here is what I wrote in another project of mine: https://github.com/rsalmei/about-time#features

xevg commented 1 year ago

I modified my code to use that. Not exactly what I wanted, but it will do. Thank you.

rsalmei commented 1 year ago

You're welcome.

xevg commented 1 year ago

I decided that I still wanted the commas, so I made the changes to the code and made a pull request. :)

rsalmei commented 1 year ago

Thanks, but the code was pretty far from what would be needed, and I closed it. If you really want to contribute, we could think together on the best naming and approach to achieve consistency and performance. Actually, even if such a feature actually makes sense, because one can get this effect pretty easily by simply customizing the widgets (now we know all it takes is a single comma within the format string).