0

This is my first question on here.

I'm trying to learn more about how to produce ANSI art in the linux terminal using Python.

I want to be able to locate a specific pixel in the terminal and change it's colour. For example if my terminal screen size is set at (120 columns x 40 rows) how could I locate the pixel at (60 x 20) so I would be able to update its value for example?

At the moment all I can think of is:

WHITE = '\033[47m'
print(" " * 60 + WHITE)

This will print a white block to the terminal on column 60 but row 1 not row 20. I'd like it to print a white block to the terminal on column 60 row 20.

Please could you point me in the right direction?

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
Looby
  • 9
  • 1
    Your question uses the word "pixel", but do you really mean "character cell"? ANSI escapes cannot manipulate individual pixels. – Daniel Pryden Apr 14 '19 at 13:22
  • Hi @DanielPryden, yes I did mean character cell - I wasn't aware of the lexis. I think I've found the code I'm looking for: \u001b[;f puts the cursor at line L column C – Looby Apr 15 '19 at 21:19

0 Answers0