# ChapterGraphics/polygon.py
# Draw five points and then a polygon
from graphics import *
winW, winH = 700,500 # window geometry
def main():
win = GraphWin( "Polygon 5 vertices", winW, winH )
points = [] # gather the vertices
for i in range( 5 ):
p = win.getMouse()
points.append( p )
c = Circle( p, 2 ) # mark where the point is
c.setFill( "black" )
c.draw( win )
p = Polygon( points )
p.setFill( "red" )
p.draw( win )
main()