Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing text to row and column coordinates in Python?

I haven't found anything about this, but maybe that's because it isn't possible. But is there a way to print text to coordinates in Python? For example, if I wanted to print the string 'A' at the 3rd row and 5th column of the command window, how could I do that? I found ways to get around it and print two different strings at different coordinates using \n for rows and repeating spaces for columns, but it's just too tedious to write the code.

like image 884
Wall_Dough Avatar asked Mar 23 '26 20:03

Wall_Dough


1 Answers

This is possible. The curses library comes standard and is documented here. There are probably others but that will do what you're looking for. In particular, curses.getsyx() might be what you need.

like image 169
GrantVS Avatar answered Mar 25 '26 09:03

GrantVS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!