Google

PIDDLE Rotation Test

PIDDLE

Rotation Test

The output above was generated by piddleQD (left) and piddlePIL (right).


"""rottest.py

This program tests drawing of rotated strings.
"""

# create a 300x300 canvas -- modify this code to use whatever
# canvas type you wish to test

#from piddleQD import *
#try: canvas.close()
#except: pass
#canvas = QDCanvas( size=(300,300) )

from piddlePIL import *
canvas = PILCanvas( size=(300,300) )

canvas.defaultFont = Font(bold=1)

canvas.defaultLineColor = (blue + white)/2
canvas.drawLine(0,150, 300,150)
canvas.drawLine(150,0, 150,300)

s = " __albatros at "
w = canvas.stringWidth(s)
canvas.drawEllipse(150-w,150-w, 150+w, 150+w, fillColor=transparent)

orange = (red+yellow)/3
colors = [red,orange,yellow,green,blue,purple]
cnum = 0
for ang in range(0, 359, 30):
	canvas.defaultLineColor = colors[cnum]
	s2 = s + str(ang)
	canvas.drawString(s2, 150, 150, angle=ang)
	cnum = (cnum+1) % len(colors)
	
canvas.flush()

if canvas.__class__.__name__ == 'PILCanvas':
	canvas.getImage().save("rottest-pil.gif")


http://www.strout.net/info/coding/python/piddle/rottest.html
Last Updated: 5/31/99 . . . . . . webmaster@strout.net