Created
February 1, 2015 07:02
-
-
Save cwake/9a992f92c20e95362697 to your computer and use it in GitHub Desktop.
Shapes homework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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