Is it possible to print a string at a certain screen position inside IDLE?

I don't know if this works on IDLE, but it does in any normal terminal:

import sys
def print_there(x, y, text):
     sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (x, y, text))
     sys.stdout.flush()

This uses Ansi-Escape Sequences


To avoid the issue raised by @user3431399, you first need to make win32 console recognize ANSI/VT100 escape sequences. I got the same problem as @user3431399 on my Windows 10 terminal and I solved it by following the solution recommended by @Daniel De Léon. That is, I logged in as administrator at the windows prompt (cmd command). Then I copied, pasted, and ran the command.

REG ADD HKCU\CONSOLE /f /v VirtualTerminalLevel /t REG_DWORD /d 1


This question only has one real answer and it isn't a very good one. The method:

import sys
def print_there(x, y, text):
     sys.stdout.write("\x1b7\x1b[%d;%df%s\x1b8" % (x, y, text))
     sys.stdout.flush()

Isn't perfect. I'd recommend staying clear of doing things like this in the terminal. If you want to do Gui's and stuff use Pygame, Tkinter, or Django.