def face_demo():
    drawing = Drawing(width=400, height=200)

    sad_face = widgetbase.Face()
    sad_face.skinColor = colors.blue
    sad_face.mood = 'sad'
    drawing.add(sad_face)

    ok_face = widgetbase.Face()
    ok_face.skinColor = colors.beige
    ok_face.mood = 'ok'
    ok_face.x = 110
    drawing.add(ok_face)

    happy_face = widgetbase.Face()
    happy_face.skinColor = colors.yellow
    happy_face.mood = 'happy'
    happy_face.x = 215
    drawing.add(happy_face)

    drawing.save(formats=['pdf'], outDir='.', fnRoot='face_demo')
Beispiel #2
0
eg("""
>>> from reportlab.lib import colors
>>> from reportlab.graphics import shapes
>>> from reportlab.graphics import widgetbase
>>> from reportlab.graphics import renderPDF
>>> d = shapes.Drawing(200, 100)
>>> f = widgetbase.Face()
>>> f.skinColor = colors.yellow
>>> f.mood = "sad"
>>> d.add(f)
>>> renderPDF.drawToFile(d, 'face.pdf', 'A Face')
""")

from reportlab.graphics import widgetbase
d = Drawing(200, 120)
f = widgetbase.Face()
f.x = 50
f.y = 10
f.skinColor = colors.yellow
f.mood = "sad"
d.add(f)
draw(d, 'A sample widget')

disc("""
Let's see what properties it has available, using the $setProperties()$
method we have seen earlier:
""")

eg("""
>>> f.dumpProperties()
eyeColor = Color(0.00,0.00,1.00)