DEV Community

Cover image for Target
Scott Gordon
Scott Gordon

Posted on

Target

This is a simple drawing of a target created using Python and the graphics.py module created by John Zelle.


# target.py
#   Archery target drawing using layered circles
# by: Scott Gordon

from graphics import *


def main():
    win = GraphWin("Target", 600, 600)
    win.setCoords(-6, -6, 6, 6)
    win.setBackground("grey")
    center = Point(0, 0)

    circle1 = Circle(center, 5)
    circle1.setFill("white")
    circle1.draw(win)

    circle1 = Circle(center, 4)
    circle1.setFill("black")
    circle1.draw(win)

    circle1 = Circle(center, 3)
    circle1.setFill("blue")
    circle1.draw(win)

    circle1 = Circle(center, 2)
    circle1.setFill("red")
    circle1.draw(win)

    circle1 = Circle(center, 1)
    circle1.setFill("yellow")
    circle1.draw(win)

    win.getMouse()
    win.close()


main()
Enter fullscreen mode Exit fullscreen mode


Enter fullscreen mode Exit fullscreen mode

Top comments (0)