5 Answers
+ 2
Sorry, Kirk, you're right, the sequence got messed up. I meant something like '\033[1A' as an example for moving a line up and similar codes. They work on qpython but don't seem to work on 3.6 under windows, neither in IDLE nor in command prompt mode.
+ 2
That colorama thing sounds nice and convenient, thank you for the hint - and for the background info! I'll be off my pc for two days, but itching to try it out asap. :-)
+ 1
Your question is in Python so...just for the record:
This is nice "here's what we have" documentation from Microsoft on virtual-terminal and ANSI sequences (includes source code samples, but in C unfortunately).
https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
Here's a question detailing imports that may allow enabling this mode automatically (colorama and tendo.ansiterm):
https://stackoverflow.com/questions/8358533/python-module-to-enable-ansi-colors-for-stdout-on-windows
Despite the colors focus, colorama does support cursor positioning.
Note that colorama intercepts ANSI escapes and issues API calls to change memory / display directly (different approach, same appearance).
0
In general, this is more terminal-related than language-related, unless your encoding has changed in a way that's interfering with sending raw bytes.
QPython may also have replaced the terminal in some way, but first:
Your example doesn't appear to be quite right, so I also want to suggest confirming that you are sending the right sequences.
0
It will be a little while before I can test this directly, so...for Windows 10 (I can keep looking if wrong OS):
There's a "solution" (actually bug, leaving the virtual terminal enabled) above this "here's code, try this" answer, but I thought the code was better to link.
https://bugs.python.org/issue30075#msg291732
If this (the VT) is the problem, you would enable the VT, save the returned terminal mode value, then restore the mode (your saved value) on exit.