Skip to content

Python script to generate svg of random truchet tiles.

License

Notifications You must be signed in to change notification settings

cpoczatek/truchet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

truchet

truchet.py is a simple script for generating Smith-type Truchet tiles, like this:

Generated by: python3 truchet.py --width 20 --height 5 --color "#800000"

Setup

The script needs 2 libraries which can be installed by running sudo pip3 install drawSvg argparse.

Arguments

Just run python3 truchet.py to run the script. All arguments are optional.

By default this image will be generated:

default image

The script is self documenting and takes these options:

python3 truchet.py --help

usage: truchet.py [-h] [--width WIDTH] [--height HEIGHT] [--tile TILE]
                  [--stroke STROKE] [--color COLOR] [--seed SEED] [--squares]
                  [--output OUTPUT]

Generate svg of random truchet tiles.

optional arguments:
  -h, --help       show this help message and exit
  --width WIDTH    Width of svg in tiles. (default: 10)
  --height HEIGHT  Height of svg in tiles. (default: 10)
  --tile TILE      Size of tile in px. (default: 40)
  --stroke STROKE  Stroke width of arcs. (default: 4)
  --color COLOR    Color of arcs. HTML colors are valid and should be
                   **quoted**. Eg: "#800000", "rgb(0,255,0)", "blue" (default:
                   navy)
  --seed SEED      Seed value for PRNG. (default: 42)
  --squares        Add tile boundaries, stroke=1/color="silver" (default:
                   False)
  --output OUTPUT  Output filename (default: truchet.svg)

About

Python script to generate svg of random truchet tiles.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages