Pythonic generative art tool
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
contextfree
examples
site
tests
.gitignore
.travis.yml
LICENSE
MANIFEST.in
README.rst
requirements.txt
setup.py
setup_boilerplate.py
test_requirements.txt

README.rst

pycontextfree

build status from Travis CI https://coveralls.io/repos/github/undertherain/pycontextfree/badge.svg?branch=master pypi version

CFDG-inspired cairo-based pythonic generative art tool

Here is an example of simple code producing stochastic fractal tree:

from contextfree.contextfree import *

@check_limits
def branch():
    line(0,1)
    with translate(0,0.9):
        with scale(0.7 + rnd(0.15)):
            with color(alpha=0.95):
                with rotate(-0.3 + rnd(0.3)):
                    branch()
                with rotate(0.3 + rnd(0.3)):
                    branch()

init(canvas_size=(300,300), background_color="#FFFFFF")
with scale(3):
    branch()

display_ipython()

Here is the output:

[tree_example]

Check examples folder for more fun stuff.

How do I get set up?

  • pip3 install contextfree for latest stable release
  • pip3 install git+https://github.com/undertherain/pycontextfree.git for recent development version
  • Python 3.6 or later is required