Progress bar in Sublime Text with Python

Viewed 2634

I am using the powerful Sublime Text 3 editor on MacOSX to run python codes. I want to display a progress bar of a for loop, and the following command:

sys.stdout.write('\rProgress : %03.2f %%' % (100*float(i)/(N)))
sys.flush()

does not clear the previously printed line in the output window as expected (\r) but produces N lines:

Progress : 0.25 %
Progress : 0.50 %
Progress : 0.75 %
Progress : 1.00 %
Progress : 1.25 %
Progress : 1.50 %
Progress : 1.75 %
Progress : 2.00 %
Progress : 2.25 %
Progress : 2.50 %
...

Which is not really nice to read – I conclude that the output window might be read-only.

Does anyone have suggestions to improve the use of progress bars in Sublime Text?

6 Answers
Related