Q:

Clear line to the right of the text displayed by progressbar. FormatCustomText (python)

I am using progressbar2 with FormatCustomText.  The text is parameterized (eg "%s") and the width of the string to display varies. 
Let's say on the first iteration, the substituted text is "AA."  On the second iteration, the text is "B."
progressbar displays BA on the second iteration instead of B.
Is there a way to clear everything to the right of the cursor to the end of the line after B?  Normally, this is done with control-K (chr(11)).  
Unfortunately, adding chr(11) to the end of the string given to FormatCustomText causes a newline character to be output for each iteration. 
Any other ideas? 

A:

There is a better answer on github

