Skip to content

Instantly share code, notes, and snippets.

@cwake
Created February 1, 2015 07:02
Show Gist options
  • Save cwake/9a992f92c20e95362697 to your computer and use it in GitHub Desktop.
Save cwake/9a992f92c20e95362697 to your computer and use it in GitHub Desktop.
Shapes homework
# graphicshomework.py
# Draws one shape (a circle), a rectangle for practice, a polygon and some text, as required. Also adds some color!
# By: Chloe Wake
# import the right module
from graphics import *
# create the window
win = GraphWin('Shapes', 400, 400)
# draw a circle
circ = Circle(Point(50, 50), 20)
circ.setFill('blue')
circ.draw(win)
# draw a rectangle, just practicing
rect = Rectangle(Point(160, 160),Point(80, 80))
rect.setFill('red')
rect.draw(win)
# Draw a polygon
poly = Polygon(Point(200, 200),Point(75, 300),Point(250, 350))
poly.setFill('green')
poly.draw(win)
# draw some text
label = Text(Point(120, 50), "My Lil Circle") #spaced just to the right
label.draw(win)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment