Skip to main content

A package for creating and drawing trees

Project description

https://img.shields.io/pypi/v/tree.svg?style=flat-square https://img.shields.io/pypi/l/Tree.svg?style=flat-square

Python package, which you can use to generate and drawing trees, realistic or fractal ones.

Usage

$ pip install Tree
from math import radians
from PIL import Image
from Tree.core import Tree
from Tree.draw import PillowDrawer

if __name__ == "__main__":
    # Create a Tree
    my_tree = Tree(
        pos = (0, 0, 0, -200),
        branches=[
            [0.5, rad(0)],
            [0.5, rad(120)],
            [0.5, rad(240)],
        ],
        sigma = (0.2, 5/180)
    )
    my_tree.grow(times=12)

    # Move the tree in the right position, so that the tree is completly in the image
    rec = my_tree.move_in_rectangle()

    # Create a image with the dimensions of the tree
    im = Image.new("RGB", my_tree.get_size())

    # Draw the tree on the image
    PillowDrawer(my_tree, im, (203, 40, 12)+(23, 90, 123), 10).draw()

    # Show the tree
    im.show()

Documentation

The documentation is hosted on Readthedocs.

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

Tree-0.2.3.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

Tree-0.2.3-py2.py3-none-any.whl (14.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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