How to use ansi codes in python colorama | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to use ansi codes in python colorama

im trying to write a program in which you can control the cursor position and choose where it goes. it is somehow like doodle jump game in which by pressing a key the cursor moves.since it is supposed to be a simple program i have to write it in colorama and not pygame. i dont know how to use ansi escapes to indicate the cursor,s position. an example of how to code that would be good.can anyone help? thanks.

5th Jun 2018, 7:33 AM
Golnaz Mesbahi
Golnaz Mesbahi - avatar
1 Answer
+ 1
To move the cursor with colorama, you should call colorama.init() (only if you are on Windows), then you can just print the ANSI escape sequences. Below are links that may help Colorama docs: https://pypi.org/project/colorama/ Wikipedia ANSI escapes: https://en.wikipedia.org/wiki/ANSI_escape_code
10th Jun 2018, 6:38 AM
Cailyn Baksh