创建和绘制树的包
Tree的Python项目详细描述
python包,可用于生成和绘制树、真实树或分形树。
用法
$ pip install Tree
frommathimportpi,radiansasradfromTree.coreimportTreefromPILimportImagebranches=((.5,rad(-30)),(.6,rad(30)),(.4,rad(60)))defmain():tree=Tree(pos=(0,0,0,-500),branches=branches)# Let the tree growtree.grow(10)# Move the tree in the right position, so that the tree is completly in the imagetree.move_in_rectangle()im=Image.new("RGB",tree.get_size(),(239,239,239))tree.draw_on(im,(85,25,0,128,53,21),(0,62,21),10)im.show()if__name__=='__main__':main()
文档
文档位于Readthedocs上。