Open pranjalchaubey opened 4 years ago
Thank you for letting me know about the issue.
Would you mind also letting me know the OS, Python version, and Terminal app that you are using, please?
hi Tai OS - Windows 10 Python - 3.6 Terminal - CMD
The code gives a similar output on the terminal running inside VS Code as well.
even though after scrolling a new bar appears
Thank you for letting me know. I apologize for the delay. I don't have access to a windows machine at the moment and cannot test it. I will try when I can use Windows.
Also there is issue on linux too. When the threads exceed size of terminal window, and when I scroll it it duplicates printing of progress bars
@SwapnilSoni1999 I see. I think that that is a different issue. Would you mind creating a new issue?
Sure sir i ll upload screen record if possible
@SwapnilSoni1999 Sounds great. Thank you.
@pranjalchaubey, I released the version 1.1.2.
I updated the escape code for controlling the cursor on the terminal.
This version might work on Windows although I haven't had a chance to test it because I didn't have a Windows machine.
Thanks @TaiSakuma, I will check it out!
@pranjalchaubey, that is great. Thank you.
Hi Tai, for me it's not fixed on windows. I am trying to run:
n = random.randint(1000, 10000)
for i in atpbar(range(n)):
time.sleep(0.00001)
And this is my result on windows CMD:
@udptcp, thank you for letting me know.
Would you mind letting me the version of Windows that you used? You wrote that you used "windows CMD". That is Windows Console, I assume. I think that atpbar might work on Windows Terminal because it seems to support ANSI escape code.
Thanks @TaiSakuma
I use Windows 10 LTSC version 1607 and tested with Windows Console. Windows Terminal needs at least version 1903 to work, so I can't check this out. But I have tried to connect via PuTTY to my machine and execute the script. This is the result:
@udptcp, thank you for letting me know about Windows Terminal. I wasn't aware that it only works with recent versions of Windows 10.
Thank you also for the screenshot on PuTTY. It might work there if the terminal is a bit wider. At the moment, atpbar doesn't work properly if the terminal width is less than 90 characters (I intend to fix it someday).
On Windows, you have to call SetConsoleMode with ENABLE_VIRTUAL_TERMINAL_PROCESSING (see https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#cursor-positioning). Doing so in python is explained here: https://stackoverflow.com/questions/36760127/how-to-use-the-new-support-for-ansi-escape-sequences-in-the-windows-10-console
I put import ctypes
kernel32 = ctypes.windll.kernel32 kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7) at the top of my script and atpbar worked great in both cmd and powershell.
A much more robust version of the code is here: https://bugs.python.org/issue30075
Hi I am trying the simple two progress bars example, but my terminal is printing each bar on a newline.
How to fix this problem?