Add folder.py - a book cover made with flex

This commit is contained in:
Florian Festi 2014-03-15 15:10:44 +01:00
parent 493aba5abb
commit 329abd8c63
2 changed files with 42 additions and 0 deletions

7
examples/folder.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 24 KiB

35
folder.py Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/python
from boxes import *
import math
class Folder(Boxes):
def __init__(self, x, y, h, r=0):
Boxes.__init__(self, width=2*x+3*h+20, height=y+20)
self.x = x
self.y = y
self.h = h
self.r = r
def render(self):
x, y, r, h = self.x, self.y, self.r, self.h
c2 = math.pi * h
self.moveTo(r+self.thickness, self.thickness)
self.edge(x-r)
self.flexEdge(c2, y)
self.edge(x-r)
self.corner(90, r)
self.edge(y-2*r)
self.corner(90, r)
self.edge(2*x-2*r+c2)
self.corner(90, r)
self.edge(y-2*r)
self.corner(90, r)
self.ctx.stroke()
self.surface.flush()
self.surface.finish()
f = Folder(240, 350, 20, 15)
f.render()