Package: termshape
termshapeTermshape 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!Installationpip install termshapeExplanation:The idea is to draw all the shapes as vectors, so you can set the size of any shape as you wish.
Each shape has equations that print it.
Theget_*functions has (x,y) range and some equations, and from them it prints the shape.Example:fromtermshapeimportget_squareprint(get_square(5))so:x-rangeis between 0 and 4y-rangeis between 0 and 4
and the equations are:x=0,y=0,x=5andy=5.See below the output.UsagePrint a square:fromtermshapeimportget_squareprint(get_square(5))* * * * *
*       *
*       *
*       *
* * * * *Print a rectangle:fromtermshapeimportget_rectangleprint(get_rectangle(10,5))* * * * * * * * * *
*                 *
*                 *
*                 *
* * * * * * * * * *Print a circle:fromtermshapeimportget_circleprint(get_circle(10))* * * * *                
              *               *            
          *                       *        
        *                           *      
      *                               *    
                                           
    *                                   *  
                                           
  *                                       *
  *                                       *
  *                                       *
  *                                       *
  *                                       *
                                           
    *                                   *  
                                           
      *                               *    
        *                           *      
          *                       *        
              *               *            
                  * * * * *Print a triangle:fromtermshapeimportget_triangularprint(get_triangular(10))*                  
* *                
*   *              
*     *            
*       *          
*         *        
*           *      
*             *    
*               *  
* * * * * * * * * *Print a shape with custom character:fromtermshapeimportget_rectangleprint(get_rectangle(10,5,fg='$'))$ $ $ $ $ $ $ $ $ $
$                 $
$                 $
$                 $
$ $ $ $ $ $ $ $ $ $Print a shape with background:fromtermshapeimportget_rectangleprint(get_square(10,bg='.'))* * * * * * * * * *
* . . . . . . . . *
* . . . . . . . . *
* . . . . . . . . *
* . . . . . . . . *
* . . . . . . . . *
* . . . . . . . . *
* . . . . . . . . *
* . . . . . . . . *
* * * * * * * * * *Print a shape with points:fromtermshapeimportget_pointspoints_array=[(0,0),(0,9),(9,0),(9,9)]print(get_points(10,10,points_array,bg='.'))* . . . . . . . . *
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
* . . . . . . . . *Print numbers:fromtermshapeimportget_numberprint(get_number(31415926,3))* * * *          *    *     *          *    * * * *    * * * *    * * * *    * * * *
      *          *    *     *          *    *          *     *          *    *      
      *          *    *     *          *    *          *     *          *    *      
* * * *          *    * * * *          *    * * * *    * * * *    * * * *    * * * *
      *          *          *          *          *          *    *          *     *
      *          *          *          *          *          *    *          *     *
* * * *          *          *          *    * * * *    * * * *    * * * *    * * * *Print a custom shape using lines:fromtermshapeimportget_lineslines=[(0,0),(9,9),(0,9),(9,0),(0,0)]print(get_lines(10,10,lines))* * * * * * * * * *
  *             *  
    *         *    
      *     *      
        * *        
        * *        
      *     *      
    *         *    
  *             *  
* * * * * * * * * *