Creating Pie Chart from Python

jepler at unpythonic.net jepler at unpythonic.net
Thu Sep 15 11:26:56 EDT 2005


There are many.

One choice would be Tkinter's Canvas.

def frac(n): return 360. * n / 500

import Tkinter
c = Tkinter.Canvas(width=100, height=100); c.pack()
c.create_arc((2,2,98,98), fill="red", start=frac(0), extent = frac(100))
c.create_arc((2,2,98,98), fill="blue", start=frac(100), extent = frac(400))
c.create_arc((2,2,98,98), fill="green", start=frac(400), extent = frac(100))
c.mainloop()

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050915/f2434b02/attachment.sig>


More information about the Python-list mailing list