-1
from graphics import*
import time

def moveAll(shapeList,dx,dy):
    for shape in shapeList:
        shape.move(dx,dy)

def moveAllOnLine(shapeList,dx,dy,repititions,delay):
    for i in range(repititions):
        moveAll(shapeList,dx,dy)
        time.sleep(delay)

def main():
    winWidth=300
    winHeight=300
    win=GraphWin('bacnd forth.',winWidth,winHeight)
    win.setCoords(0,0,winWidth,winHeight)
    rect=Rectangle(Point(200,90),Point(220,100))
    rect.setFill("blue")
    rect.draw(win)
    head=Circle(Point(40,100),25)
    head.setFill("blue")
    head.draw(win)
    eye1=Circle(Point(30,105),5)
    eye1.setFill('blue')
    eye1.draw(win)
    eye2=Circle(Point(45,105),Point(55,105))
    eye2.setWidth(3)
    eye2.draw(win)
    mouth=Oval(Point(30,90),Point(50,85))
    mouth.setFill("red")
    eye2.draw(win)
    faceList=[head,eye1,eye2,mouth]
    cir2=Circle(Point(150,125),25)
    cir2.setFill("red")
    cir2.draw(win)
    moveAllOnLine(faceList,5,0,46,.05)
    moveAllOnLine(faceList,-5,0,46,.05)
    Text(Point(winWidth/2,20),'click here to quit').draw(win)
    win.getMouse()
    win.close()

main()
4

1 に答える 1