Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # shapes.py
- # I. Boaz
- # CSC 110
- # 10/17/19
- from graphics import *
- WIDTH = 600
- HEIGHT = 400
- def main():
- win = GraphWin("Shapes", WIDTH, HEIGHT)
- win.setBackground("white")
- line(0, HEIGHT/2, WIDTH, HEIGHT/2, win)
- line(WIDTH/2, 0, WIDTH/2, HEIGHT/2, win)
- line(WIDTH/3, HEIGHT/2, WIDTH/3, HEIGHT, win)
- line(WIDTH/3 * 2, HEIGHT/2, WIDTH/3 * 2, HEIGHT, win)
- rect = Rectangle(Point(50, 50), Point(WIDTH/2-50, HEIGHT/2-50))
- rect.setFill("magenta")
- rect.setWidth(5)
- rect.draw(win)
- poly = Polygon(Point(WIDTH/4*3, 50), Point(WIDTH-50, HEIGHT/2-50), Point(WIDTH/2+50, HEIGHT/2-50))
- poly.setFill("black")
- poly.setOutline("red")
- poly.setWidth(5)
- poly.draw(win)
- circle = Circle(Point(100, HEIGHT/4*3), 50)
- circle.setFill("blue")
- circle.setOutline("orange")
- circle.setWidth(5)
- circle.draw(win)
- def line(x1, y1, x2, y2, win):
- line = Line(Point(x1, y1), Point(x2, y2))
- line.setWidth(5)
- line.draw(win)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement