termtools.terminal.TerminalController[source]¶Bases: object
A class for controlling where to print on a screen and the attributes of text to be printed.
Methods Summary
attrib([attrib]) |
sets the text attributes |
background([background]) |
sets the text background color |
bookmark() |
saves current cursor position |
clear() |
clears the screen |
color([color]) |
sets the text foreground color |
down([n]) |
goes down the specified number of rows |
eraseDown() |
erases all text from currnt line to the end of the screen |
eraseLine() |
erases all text from currnt line |
eraseToBOL() |
erases all text from currnt location to the beginning of the line |
eraseToEOL() |
erases all text from currnt location to the end of the line |
eraseUp() |
erases all text from currnt line to the beginning of the screen |
goto([x, y]) |
goes to the specified x-y coordingates on the screen |
goto_bookmark() |
goes to current bookmarked position (must use bookmark() before it) |
home([erase_screen]) |
gets the cursor to the top of the screen |
left([n]) |
goes left the specified number of rows |
print(*args, **kwargs) |
|
printat(txt[, x, y]) |
goes to the specified x-y coordingates on the screen and prints the text. |
reset_attributes() |
resets all text attributes to their defaults |
right([n]) |
goes right the specified number of rows |
set_attribute([attrib]) |
sets the text attributes |
set_attributes([color, background, attrib]) |
sets the text attributes to be used by new prints. a value of “keep” keeps the current set |
set_background([background]) |
sets the text background color |
set_foreground([color]) |
sets the text foreground color |
up([n]) |
goes up the specified number of rows |
Methods Documentation
attrib(attrib='keep')[source]¶sets the text attributes
| Parameters: | attrib – one of [‘bright’,’dim’,’underscore’,’blink’,’reverse’,’hidden’] |
|---|---|
| Return type: | TerminalController |
background(background='keep')[source]¶sets the text background color
| Parameters: | background – one of [‘black’,’red’,’green’,’yellow’,’blue’,’magenta’,’cyan’,’white’] |
|---|---|
| Return type: | TerminalController |
bookmark()[source]¶saves current cursor position
| Return type: | TerminalController |
|---|
clear()[source]¶clears the screen
| Return type: | TerminalController |
|---|
color(color='keep')[source]¶sets the text foreground color
| Parameters: | color – one of [‘black’,’red’,’green’,’yellow’,’blue’,’magenta’,’cyan’,’white’] |
|---|---|
| Return type: | TerminalController |
down(n=1)[source]¶goes down the specified number of rows
| Parameters: | n – The number of rows to go down (a negative number goes up) |
|---|---|
| Return type: | TerminalController |
eraseDown()[source]¶erases all text from currnt line to the end of the screen
| Return type: | TerminalController |
|---|
eraseLine()[source]¶erases all text from currnt line
| Return type: | TerminalController |
|---|
eraseToBOL()[source]¶erases all text from currnt location to the beginning of the line
| Return type: | TerminalController |
|---|
eraseToEOL()[source]¶erases all text from currnt location to the end of the line
| Return type: | TerminalController |
|---|
eraseUp()[source]¶erases all text from currnt line to the beginning of the screen
| Return type: | TerminalController |
|---|
goto(x=0, y=0)[source]¶goes to the specified x-y coordingates on the screen
| Parameters: |
|
|---|---|
| Return type: |
goto_bookmark()[source]¶goes to current bookmarked position (must use bookmark() before it)
| Return type: | TerminalController |
|---|
home(erase_screen=False)[source]¶gets the cursor to the top of the screen
| Return type: | TerminalController |
|---|
left(n=1)[source]¶goes left the specified number of rows
| Parameters: | n – The number of rows to go up (a negative number goes right) |
|---|---|
| Return type: | TerminalController |
printat(txt, x=0, y=0)[source]¶goes to the specified x-y coordingates on the screen and prints the text.
| Parameters: |
|
|---|---|
| Return type: |
reset_attributes()[source]¶resets all text attributes to their defaults
| Return type: | TerminalController |
|---|
right(n=1)[source]¶goes right the specified number of rows
| Parameters: | n – The number of rows to go up (a negative number goes left) |
|---|---|
| Return type: | TerminalController |
set_attribute(attrib='keep')[source]¶sets the text attributes
| Parameters: | attrib – one of [‘bright’,’dim’,’underscore’,’blink’,’reverse’,’hidden’] |
|---|---|
| Return type: | TerminalController |
set_attributes(color='keep', background='keep', attrib='keep')[source]¶sets the text attributes to be used by new prints. a value of “keep” keeps the current set
| Parameters: |
|
|---|---|
| Return type: |
set_background(background='keep')[source]¶sets the text background color
| Parameters: | background – one of [‘black’,’red’,’green’,’yellow’,’blue’,’magenta’,’cyan’,’white’] |
|---|---|
| Return type: | TerminalController |
set_foreground(color='keep')[source]¶sets the text foreground color
| Parameters: | color – one of [‘black’,’red’,’green’,’yellow’,’blue’,’magenta’,’cyan’,’white’] |
|---|---|
| Return type: | TerminalController |
up(n=1)[source]¶goes up the specified number of rows
| Parameters: | n – The number of rows to go up (a negative number goes down) |
|---|---|
| Return type: | TerminalController |