美文网首页
# c05ex02.pyw

# c05ex02.pyw

作者: 特丽斯纳普 | 来源:发表于2018-03-29 16:37 被阅读0次

    c05ex02.pyw

    An archery target.

    from graphics import *

    def main():
    # Create a window
    win = GraphWin("Archery Target", 400, 400)
    win.setCoords(-6, -6, 6, 6)
    win.setBackground("gray")
    center = Point(0,0)

    c1 = Circle(center, 5)
    c1.setFill("white")
    c1.draw(win)
    
    c2 = Circle(center, 4)
    c2.setFill("black")
    c2.draw(win)
    
    c3 = Circle(center, 3)
    c3.setFill("blue")
    c3.draw(win)
    
    c4 = Circle(center, 2)
    c4.setFill("red")
    c4.draw(win)
    
    c5 = Circle(center, 1)
    c5.setFill("yellow")
    c5.draw(win)
    
    win.getMouse()
    win.close()
    

    main()

    相关文章

      网友评论

          本文标题:# c05ex02.pyw

          本文链接:https://www.haomeiwen.com/subject/mltvcftx.html