zvibazak / termshape Goto Github PK
View Code? Open in Web Editor NEWPython library for drawing basic shapes on terminal
License: MIT License
Python library for drawing basic shapes on terminal
License: MIT License
The current implementation: All shape functions use a space character (' '
) to a background character, i think that an extra optional paramater to the background character is good.
Add option to add text that will be written in a shape.
Need to calc if text is not too long.
from termshape import get_triangle
print(get_triangle(10))
original function name:
def get_triangular(h,ch='*'):
...
the correct is:
from termshape import get_triangular
print(get_triangular(10))
changes in the README.md are necessary.
The current implementation: All shape functions use a space character (' '
) to a background character, i think that an extra optional paramater to the background character is good.
The function has 5 parameteres.
width
, height
, start_x
, start_y
and lines
.
The function creates an empty canvas of width
x height
.
And start drawings the lines
x and y from start_x
and start_y
.
termshape.custom(10, 10, 0, 0, [(5, 5), (5, 2), (7, 8)])
X 0 1 2 3 4 5 6 7 8 9
Y
0 * - - - - - - - - -
1 - * - - - - - - - -
2 - - * - - * - - - -
3 - - - * - * * - - -
4 - - - - * * - * - -
5 - - - - - * - * - -
6 - - - - - - - * - -
7 - - - - - - - * - -
8 - - - - - - - * - -
9 - - - - - - - - - -
Observation: the '-'
is a space by default (' '
), this is just to better style.
I don't know if I explained right, but for any questions, create a comment.
When i use a negative value, such as get_square(-5, -5)
:
ValueError: min() arg is an empty sequence
is raised.
Is something relationated with this lines:
# calc min_x, min_y for range with negative values
min_x = abs(min(list_x))
min_y = abs(min(list_y))
in the function make_shape()
.
And I don't think if is allowed to use a negative number.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.