[Tutor] How do I make Python draw?
dyoo at hkn.eecs.berkeley.edu
Wed Jul 27 23:04:30 CEST 2005
On Wed, 27 Jul 2005, Nathan Pinno wrote:
> How do I make Python draw a shape? e.g. a triangle Is there a specific
> module that I have to call, or what is the command(s)?
If you'd like to start doing graphical stuff, you might want to look at
the Tkinter module.
There's an introduction to it here:
Just to whet your appetite, here's a quick-and-dirty demo program that
should draw a triangle for you:
"""Draws a triangle on a Tkinter canvas."""
from Tkinter import *
canvas = Canvas()
canvas.create_polygon([(1, 1), (1, 200), (100, 100)])
If you want to do more sophisticated graphics stuff, there are alternative
packages, like pygame:
If you have more questions, please feel free to ask!
More information about the Tutor