Skip to main content

Tremshape is a minimalistic Python packgage, that only prints basic shapes on terminal.

Project description

PyPI version fury.io codecov Tests

termshape

Termshape is a minimalistic Python package, that only prints basic shapes on terminal. It does not have any dependencies.

You're welcome to add any shapes!

Installation

pip install termshape

Explain:

The get_* functions has (x,y) ranges, and some equations and print the lines.

Example:

from termshape import get_square
print(get_square(5, 5))

so: x-range is between 0 and 4 y-range is between 0 and 4 and the equations are: x=0, y=0, x=5 and y=5.

See below the output.

Usage

  • Print a square:
from termshape import get_square
print(get_square(5))
* * * * *
*       *
*       *
*       *
* * * * *
  • Print a rectangle:
from termshape import get_rectangle 
print(get_rectangle(10, 5))
* * * * * * * * * *
*                 *
*                 *
*                 *
* * * * * * * * * *
  • Print a circle:
from termshape import get_circle
print(get_circle(10))
                  * * * * *                
              *               *            
          *                       *        
        *                           *      
      *                               *    

    *                                   *  

  *                                       *
  *                                       *
  *                                       *
  *                                       *
  *                                       *

    *                                   *  

      *                               *    
        *                           *      
          *                       *        
              *               *            
                  * * * * *                
  • Print a triangle:
from termshape import get_triangular
print(get_triangular(10))
*                  
* *                
*   *              
*     *            
*       *          
*         *        
*           *      
*             *    
*               *  
* * * * * * * * * *
  • Print a shape with custom character:
from termshape import get_rectangle
print(get_rectangle(10, 5, fg='$'))
$ $ $ $ $ $ $ $ $ $
$                 $
$                 $
$                 $
$ $ $ $ $ $ $ $ $ $
  • Print a shape with background:
from termshape import get_rectangle
print(get_square(10, bg='.'))
* * * * * * * * * *
* . . . . . . . . *
* . . . . . . . . *
* . . . . . . . . *
* . . . . . . . . *
* . . . . . . . . *
* . . . . . . . . *
* . . . . . . . . *
* . . . . . . . . *
* * * * * * * * * *
  • Print a shape with points:
from termshape import get_points
points_array = [(0, 0), (0, 9), (9, 0), (9, 9)]
print(get_points(10, 10, points_array, bg='.'))
* . . . . . . . . *
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
* . . . . . . . . *
  • Print numbers:
from termshape import get_numbers
print(get_numbers(31415926,3))
* * * *          *    *     *          *    * * * *    * * * *    * * * *    * * * *
      *          *    *     *          *    *          *     *          *    *      
      *          *    *     *          *    *          *     *          *    *      
* * * *          *    * * * *          *    * * * *    * * * *    * * * *    * * * *
      *          *          *          *          *          *    *          *     *
      *          *          *          *          *          *    *          *     *
* * * *          *          *          *    * * * *    * * * *    * * * *    * * * *

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

termshape-1.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

termshape-1.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file termshape-1.1.0.tar.gz.

File metadata

  • Download URL: termshape-1.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.8.6

File hashes

Hashes for termshape-1.1.0.tar.gz
Algorithm Hash digest
SHA256 3aa9f003271749898f0e99bc12b57378ba5b582ae47e0efabb25bd62313b86fa
MD5 02bd442d07b9be24493d4a0b53ac57dc
BLAKE2b-256 d048d0dc64127afb9861e1e758f3a0ef94a6a8745cb8f150af774e53e38e0c01

See more details on using hashes here.

File details

Details for the file termshape-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: termshape-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.8.6

File hashes

Hashes for termshape-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9882d985d9ca4b0e9a9b72517526efa7d95b9997fe90e3f1156c4b111b230c61
MD5 1198729f81343db525bad41c5f37ceac
BLAKE2b-256 baf20ba7d54b2729be9e57b63ad2b54d0816c76ab6002e81d3e5c01bb3a4ef7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page