zvibazak / termshape

Python library for drawing basic shapes on terminal
MIT License
4 stars 1 forks source link

little improvements and new custom shape #17

Closed scriptprinter closed 4 years ago

scriptprinter commented 4 years ago

Some little improvements and a new custom shape get_lines():

New shape get_lines()

This is the implementation of the issue #5:

Example

from termshape import get_lines
lines = [(0, 0), (9, 9), (0, 9), (9, 0), (0, 0)]
print(get_lines(10, 10, lines))
* * * * * * * * * *
  *             *  
    *         *    
      *     *      
        * *        
        * *        
      *     *      
    *         *    
  *             *  
* * * * * * * * * *

Documentation

Creates a custom shape of lines.

Positional arguments:
    width  - width of the shape.
    height - height of the shape.
    lines  - an array of tuples, each tuple (x, y).

Keyword arguments:
    fg - foreground character.
    bg - background character.

Lines system:
    The (x, y) of the start of the current line is the last (x, y),
    and the end of the current line is the current (x, y).

    The start of the first line is the first (x, y) of the lines array.

Little changes

Info

README.md and test_termshape.py i changed them for this pull request. I think that is just this changes, now you just need to filter them.

zvibazak commented 4 years ago

Great! Nice work!