I've just recently started delving into the blessed
library for Python. My intention here was to fill the entire screen with a character. blessed
luckily features a method in the Terminal
class named move_xy()
, allowing me to print a character anywhere I want on the screen provided a row and column 'co-ordinate'. The following is what I've done:
import blessed
import time
import os
terminal = blessed.Terminal()
time.sleep(3)
print(os.get_terminal_size())
for i in range(0,238):
for j in range(0,67):
print(terminal.move_xy(i,j)+"8")
t = input('Stopgap')
238 and 67 are not arbitrary values; 237 and 66 are outputted by os.get_terminal_size()
. Upon running the program in a full-screen terminal, I instead get characters printed diagonally across the screen. Setting it instead to print(terminal.move_xy(i,j)+"8", end = '')
fixes the issue
This is what I find puzzling. Why should we specify end = ''
? Isnt terminal.move_xy(i,j)
moving us exactly where we want on screen? So why should the default value of the end argument, \n
factor into this? If I am specifying exactly where to print, why should the end argument matter exactly? I am thoroughly confused