Minimal terminal canvas
Project description
pytermcanvas
Requirements
- terminal emulator (with true color support)
- python3
Install
pip install pytermcanvas
Usage
class TerminalCanvas(x_size, y_size, auto_render, empty_char)
Parameters:
- x_size (Int) - number of columns to use, stored in self.cols
- y_size (Int) - number of rows to use, stored in self.rows
- auto_render (Bool) [default:
True
]True
- enable automatic canvas renderingFalse
- disable automatic canvas rendering
- empty_char (Char) [default:
SPACE
] - character used to fill the canvas on creation
Methods:
render()
Renders canvas
clear()
Clears canvas
resize(x_size, y_size)
- x_size (Int) - number of columns to use, stored in self.cols
- y_size (Int) - number of rows to use, stored in self.rows
drawImage(*path, ***kwargs)
Draws image on canvas
- path (Str) - path to image
- mode (Str) [default:
bg
] - mode to use for renderingbg
- change color behind characterfg
- change color of specified character
- size (List or Tuple) [default: canvas size] - desired size of image
- size[0] (Int) - number of columns to use
- size[1] (Int) - number of rows to use
- char (Char) [defualt:
SPACE
] - character to print, mainly used forfg
rendering
drawRect(*col, row, width, height, ***kwargs)
Draws rectangle on canvas
- col (Int) - position of top left corner in column
- row (Int) - position of top left corner in row
- width (Int) - width of rectangle
- height (Int) - height of rectangle
- mode (Str) [default:
bg
] - mode to use for renderingbg
- change color behind characterfg
- change color of specified character
- color (List or Tuple) [default:
(255, 255, 255)
] - RGB color of rectangle- color[0] (Int) - Red,
0 - 255
- color[1] (Int) - Green,
0 - 255
- color[2] (Int) - Blue,
0 - 255
- color[0] (Int) - Red,
- char (Char) [defualt:
SPACE
] - character to print, mainly used forfg
rendering
insertRow(row, data, offset)
Inserts set of characters to specified row
- row (Int) - row to insert data to
- data (Str, List or Tuple) - data inserted into desired row
- (Str) - standard string
- (List or Tuple) - sequence of characters
- offset (Int) [default:
0
] - defines the starting column
insertCol(col, data, offset)
Inserts set of characters to specified column
- col (Int) - column to insert data to
- data (Str, List or Tuple) - data inserted into desired column
- (Str) - standard string
- (List or Tuple) - sequence of characters
- offset (Int) [default:
0
] - defines the starting row
getRow(row)
Returns list of characters from specified row
- row (Int) - row to fetch data from
getCol(col)
Returns list of characters from specified column
- col (Int) - column to fetch data from
setChar(col, row, char)
Changes character on specified location
- col (Int) - column of character
- row (Int) - row of character
- char (Char) - replacement character
getChar(col, row)
Returns character from specified location
- col (Int) - column of character
- row (Int) - row of character
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytermcanvas-1.0.0.tar.gz
(3.7 kB
view details)
Built Distribution
File details
Details for the file pytermcanvas-1.0.0.tar.gz
.
File metadata
- Download URL: pytermcanvas-1.0.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a7674ba0ac48643d2d54c849b937b26b8275eae7bc73c099ef5c028ba89fd8c |
|
MD5 | f9ddbd7a8d78b54b09426ba99bc2d317 |
|
BLAKE2b-256 | e01c595629a950dcb808565c87d3ad33eec4f3a5858f4eb59ed15ef161d36c1f |
File details
Details for the file pytermcanvas-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pytermcanvas-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | acf6e91209d459689988b781190a3910bbad3edc612d024ba8f366cb85a14fa5 |
|
MD5 | 4e2aac27d016d30aaa0997c037c927eb |
|
BLAKE2b-256 | b43967c3273575553018d11596187130273f44bc39615ab92180db2a179bfb27 |