예제 #1
0
def main():
    '''
	  Creates a scene with a dog licking an ice cream cone outside
	  in the sun. The sun's rays alternate between yellow and orange.
	  The ice cream tips over and the dog stops licking.
	'''
    win = gr.GraphWin('Ice Cream Dog', 600, 600, False)

    background = sg.background_init(0, 0, 1.5)
    dog = sg.dog_init(100, 425, 1.0)
    icecream = sg.icecream_init(383, 463, 2.0)

    images = [background, icecream, dog]

    for item in images:
        sg.draw(item, win)

    frame_num = 0
    while True:
        time.sleep(0.25)

        for item in images:
            sg.background_animation_frame(background, frame_num, win)
            sg.icecream_animation_frame(icecream, frame_num, win)
            sg.dog_animation_frame(dog, frame_num, win)

        frame_num += 1
        win.update()
        # 		saveFrame( 'scenemovie', win, frame_num )
        if win.checkMouse():
            break

    win.close()
예제 #2
0
def justCrystalBall_test():
    '''Create a window, draw the crystal ball into the window'''
    winW, winH = 500, 400
    win = gr.GraphWin('justCrystalBall', 500, 400, False)

    crystalBall1 = crystalBall_init(0, 0, 1.0)
    crystalBall2 = crystalBall_init(-100, 50, .5)
    crystalBall3 = crystalBall_init(-200, 100, 2.0)

    draw(crystalBall1, win)
    draw(crystalBall2, win)
    draw(crystalBall3, win)

    for frame_num in range(2):
        time.sleep(0.25)

        crystalBall_animate(crystalBall1, frame_num, win)
        crystalBall_animate(crystalBall2, frame_num, win)
        crystalBall_animate(crystalBall3, frame_num, win)

        win.update()
        if win.checkMouse():
            break

    win.getMouse()
    win.close()
예제 #3
0
def justFire_test():
    '''Create a window, draw the fire into the window'''
    winW, winH = 500, 400
    win = gr.GraphWin('justFire', 500, 400, False)

    fire1 = fire1_init(150, 300, 1.3)
    fire2 = fire2_init(150, 300, 1.3)

    fire3 = fire1_init(100, 100, 1.0)
    fire4 = fire2_init(100, 100, 1.0)

    fire5 = fire1_init(300, 100, 2.0)
    fire6 = fire2_init(300, 100, 2.0)

    draw(fire1, win)
    draw(fire2, win)
    draw(fire3, win)
    draw(fire4, win)
    draw(fire5, win)
    draw(fire6, win)

    for frame_num in range(20):
        time.sleep(0.25)

        justFire_animate(fire1, fire2, frame_num, win)
        justFire_animate(fire3, fire4, frame_num, win)
        justFire_animate(fire5, fire6, frame_num, win)

        win.update()
        if win.checkMouse():
            break

    win.getMouse()
    win.close()
예제 #4
0
def test_dog():
	'''
	  Creates a window and plots a scene with a picture 
	  of a dog in it, that wags its tail and sticks out
	  its tongue, then moves its head and continues licking.
	'''
	win = gr.GraphWin( 'title', 700, 700, False )

	dog1 = dog_init( 100, 500, 1.0 )
	dog2 = dog_init( 50, 200, 1.0 )
	dog3 = dog_init( 400, 400, 0.8 )
	
	dogs = [dog1,dog2,dog3]
	
	for dog in dogs:
		draw( dog, win )
		
	frame_num = 0
	while True:
		time.sleep(0.25)
		for dog in dogs:
			dog_animation_frame(dog, frame_num, win)
		frame_num += 1
		win.update()
		if win.checkMouse():
			break
	
	win.update()

	win.getMouse()
	win.close()	
예제 #5
0
def warhol(filename, listOfEffects):
    # read the image from the file
    original = gr.Image(gr.Point(0, 0), filename)

    rows = original.getHeight()
    cols = original.getWidth()
    panels = len(listOfEffects)

    # create a window based on the image and how many copies
    win = gr.GraphWin('Warhol', cols * panels, rows)
    allimages = []

    # for each effect
    for i in range(panels):
        # clone the original image
        clone = original.clone()  # duplicates the Image object
        # apply the filter to the clone
        if listOfEffects[i] == 'swaprb':
            filter.swaprb(clone)
        elif listOfEffects[i] == 'reduceGreen':
            filter.reduceGreen(clone)
        elif listOfEffects[i] == 'whitecover':
            filter.whitecover(clone)

        # move the image to the right location
        clone.move(cols / 2 + i * cols, rows / 2)
        # draw the image into the window
        clone.draw(win)
        allimages.append(clone)

    # return the window
    return win, allimages
예제 #6
0
def test_background():
	'''
	  Creates a window and plots a scene with a background
	  image of a sky, ground, and sun that changes colors.
	'''
	win = gr.GraphWin( 'title', 800, 800, False )

	background1 = background_init( 0, 0, 1.0 )
	background2 = background_init( 50, 450, 0.5 )
	background3 = background_init( 450, 100, 0.7 )
	
	backgrounds = [background1,background2,background3]
	
	for background in backgrounds:
		draw( background, win )
	
	frame_num = 0
	while True:
		time.sleep(0.25)
		for background in backgrounds:
			background_animation_frame(background, frame_num, win)
		frame_num += 1
		win.update()
		if win.checkMouse():
			break
	
	win.update()

	win.getMouse()
	win.close()
예제 #7
0
def main():

    win = gr.GraphWin('Mario', 1000, 1000, False)

    mario = init_mario(400, 600, 2)

    for item in mario:
        item.draw(win)

    # time loop
    frame = 0
    while True:
        key = win.checkKey()
        if key == 'q':
            break

        if win.checkMouse() != None:
            break

        animate_mario(mario, frame, win)
        win.update()
        time.sleep(0.033)
        frame += 1

    win.getMouse()
    win.close()
예제 #8
0
def main(argv):

    if len(argv) < 2:
        print("usage: python3 image.py <image filename>")
        return

    # read in the image from the filename specified on the command
    filename = argv[1]
    image = gr.Image(gr.Point(0, 0), filename)

    # create a window that is the same size as the image
    rows = image.getHeight()
    cols = image.getWidth()
    win = gr.GraphWin(filename, cols, rows)

    # move the image so it is centered in the window
    image.move(cols / 2, rows / 2)

    # call the filter function before the image is drawn into a window
    # swaprb( image )
    # reduceGreen( image )
    whitecover(image)

    image.draw(win)

    win.getMouse()
    win.close()
예제 #9
0
def justCat_test():
    '''Create a window, draw the cat into the window'''
    winW, winH = 500, 400
    win = gr.GraphWin('justCat', 500, 400, False)

    catArm1 = catArm_init(0, 0, 1.0)
    cat1 = cat_init(0, 0, 1.0)
    catArm2 = catArm_init(50, 50, 2.0)
    cat2 = cat_init(50, 50, 2.0)
    catArm3 = catArm_init(0, 0, .5)
    cat3 = cat_init(0, 0, .5)

    draw(cat1, win)
    draw(catArm1, win)
    draw(cat2, win)
    draw(catArm2, win)
    draw(cat3, win)
    draw(catArm3, win)

    for frame_num in range(20):
        time.sleep(0.25)

        justCat_animate(catArm1, frame_num, win)
        justCat_animate(catArm2, frame_num, win)
        justCat_animate(catArm3, frame_num, win)

        win.update()
        if win.checkMouse():
            break

    win.getMouse()
    win.close()
예제 #10
0
def test_justWitch():
    '''Create a window, draw the witch into the window'''
    winW, winH = 500, 400
    win = gr.GraphWin('justWitch', 500, 400, False)

    witch1 = witch_init(150, 300, 1.3)
    witchArms1 = witchArms_init(150, 300, 1.3)

    witch2 = witch_init(100, 100, .75)
    witchArms2 = witchArms_init(100, 100, .75)

    witch3 = witch_init(400, 300, 1)
    witchArms3 = witchArms_init(400, 300, 1)

    draw(witch1, win)
    draw(witchArms1, win)
    draw(witch2, win)
    draw(witchArms2, win)
    draw(witch3, win)
    draw(witchArms3, win)

    for frame_num in range(10):
        time.sleep(0.25)

        justWitch_animate(witchArms1, frame_num, win)
        justWitch_animate(witchArms2, frame_num, win)
        justWitch_animate(witchArms3, frame_num, win)

        win.update()
        if win.checkMouse():
            break

    win.getMouse()
    win.close()
예제 #11
0
def test_icecream():
	'''
	  Create a window and plot a scene with a picture 
	  of an ice cream cone in it, that tips over.
	'''
	win = gr.GraphWin( 'title', 400, 400, False )

	icecream1 = icecream_init( 100, 150, 2.0 )
	icecream2 = icecream_init( 50, 200, 0.5 )
	icecream3 = icecream_init( 300, 300, 1.0 )
	
	icecreams = [icecream1,icecream2,icecream3]
	
	for icecream in icecreams:
		draw( icecream, win )
	frame_num = 0
	while True:
		time.sleep(0.25)
		for icecream in icecreams:
			icecream_animation_frame(icecream, frame_num, win)
		frame_num += 1
		win.update()
		if win.checkMouse():
			break
	
	win.update()

	win.getMouse()
	win.close()
예제 #12
0
def test_witch():
    '''Create a window, draw the witch scene into the window'''
    winW, winH = 500, 400
    win = gr.GraphWin('Witch', 500, 400, False)

    background = background_init(0, 0, 1.0)
    cat = cat_init(0, 0, 1.0)
    potion = potion_init(0, 0, 1.0)
    plant = plant_init(0, 0, 1.0)
    catArm = catArm_init(0, 0, 1.0)
    witch = witch_init(150, 300, 1.3)
    witchArms = witchArms_init(150, 300, 1.3)
    cauldron = cauldron_init(150, 300, 1.3)
    fire1 = fire1_init(150, 300, 1.3)
    fire2 = fire2_init(150, 300, 1.3)
    crystalBall = crystalBall_init(0, 0, 1.0)

    draw(background, win)
    draw(cat, win)
    draw(potion, win)
    draw(plant, win)
    draw(catArm, win)
    draw(witch, win)
    draw(witchArms, win)
    draw(cauldron, win)
    draw(fire1, win)
    draw(fire2, win)
    draw(crystalBall, win)

    for frame_num in range(1):
        time.sleep(0.25)

        witch_animate(witchArms, fire1, fire2, frame_num, win)

        win.update()
        if win.checkMouse():
            break

    for frame_num in range(2):
        time.sleep(0.25)
        # crystalBall_animate(crystalBall, frame_num, win)
        witchWithCat_animate(witchArms, fire1, fire2, crystalBall, catArm,
                             frame_num, win)

        win.update()
        if win.checkMouse():
            break

    for frame_num in range(10):
        time.sleep(0.25)

        witch_animate(witchArms, fire1, fire2, frame_num, win)

        win.update()
        if win.checkMouse():
            break

    win.getMouse()
    win.close()
예제 #13
0
def main(argv):
    win=gr.GraphWin("My window",500,500)
    c=gr.Circle(gr.Point(250, 250),10)
    c.draw(win)
    win.getMouse()
    c.setFill("green")
    win.getMouse()
    c.move(50,-40)
    win.getMouse()
    win.close()
    return
예제 #14
0
def main():
    # assign to win a GraphWin object made with title, width, height, and the value False
    win = gr.GraphWin("rocketship!", 600, 600, False)
    # (note the final parameter is not one we have used before. It makes it so the
    # window doesn't attempt to redraw after every change).

    # assign to shapes an empty list
    shapes = []

    # assign to c a new Circle object at (250, 250) with radius 10
    c = gr.Circle(gr.Point(250, 250), 10)
    # call the draw function of the circle object stored in c
    c.draw(win)
    # append the variable c to the list shapes
    shapes.append(c)
    # while True
    while True:
        # call time.sleep with a half-second delay (0.5)
        time.sleep(0.5)
        # for each thing in shapes
        for thing in shapes:
            # assign to dx a random integer between -10 and 10
            dx = random.randint(-10, 10)
            # assign to dy a random integer between -10 and 10
            dy = random.randint(-10, 10)
            # call the move method of the object referred to by thing, passing in dx and dy
            thing.move(dx, dy)

            #color
            r = random.randint(0, 255)
            g = random.randint(0, 255)
            b = random.randint(0, 255)
            color = gr.color_rgb(r, g, b)
            thing.setFill(color)

            #clone
            if random.random() < 0.2:
                oldthing = random.choice(shapes)
                newthing = oldthing.clone()
                newthing.draw(win)
                shapes.append(newthing)

        # tell the window to update its display (call win.update())
        win.update()

        # if win.checkMouse() is not None
        if win.checkMouse() is not None:
            break
        # break out of the while loop

    # close the window
    win.close()
예제 #15
0
def main():

    win = gr.GraphWin('whales', 1000, 1000)

    # whale is a list of graphics objects
    whale = citywhale(500, 500, 2.0)

    #  draw each graphics object into the window
    for thing in whale:
        thing.draw(win)

    win.getMouse()
    win.close()
예제 #16
0
def test_sun():
    win = gr.GraphWin("My window", 1500, 1500)

    sun1 = init_sun(300, 300, 1)
    sun2 = init_sun(250, 2500, 0.5)
    sun3 = init_sun(400, 400, 2)
    # The draw function which carries two arguments, first is the sun1 which is the list of zelle shapes which makes objects
    draw(sun1, win)
    draw(sun2, win)
    draw(sun3, win)

    win.getMouse()
    win.close()
예제 #17
0
def main():

    # create a window and tell it not to auto-update
    win = gr.GraphWin('whales', 1000, 1000, False)

    # whale is a list of graphics objects
    whale = citywhale(500, 500, 2.0)

    whale2 = citywhale(200, 800, 4.0)

    # draw each graphics object into the window
    #for thing in whale:
    #    thing.draw( win )
    draw(whale, win)
    draw(whale2, win)

    while True:

        # check for a keystroke
        key = win.checkKey()
        if key == 'q':
            break  # exit the loop

        # move the whales left
        move(whale, -1, 0)
        move(whale2, -2, 0)

        # using the whale's eye to check it's horizontal location
        p1 = whale[2].getCenter()
        # if the eye goes out of bounds, move it right
        if p1.x < 0:
            move(whale, win.getWidth(), 0)
            # change the color when it shifts
            whale[0].setFill(
                gr.color_rgb(random.randint(0, 255), random.randint(0, 255),
                             random.randint(0, 255)))

        # same check for whale 2
        p2 = whale2[2].getCenter()
        if p2.x < 0:
            move(whale2, win.getWidth(), 0)
            whale2[0].setFill(
                gr.color_rgb(random.randint(0, 255), random.randint(0, 255),
                             random.randint(0, 255)))

        # need to update each time for smooth motion
        win.update()

    # wait for a mouse click
    win.getMouse()
    win.close()
예제 #18
0
def test_pool():
    win = gr.GraphWin("My window", 1000, 1000)

    pool1 = init_pool(300, 300, 1)
    pool2 = init_pool(250, 250, 0.5)
    pool3 = init_pool(400, 400, 2)

    # The draw function which carries two arguments, first is the sun1 which is the list of zelle shapes which makes objects
    draw(pool1, win)
    draw(pool2, win)
    draw(pool3, win)

    win.getMouse()
    win.close()
예제 #19
0
def test_justCauldron():
    '''Create a window, draw the cauldron into the window'''
    winW, winH = 500, 400
    win = gr.GraphWin('justCauldron', 500, 400, False)

    cauldron1 = cauldron_init(150, 300, 1.3)
    cauldron2 = cauldron_init(100, 100, .75)
    cauldron3 = cauldron_init(400, 300, 1.0)

    draw(cauldron1, win)
    draw(cauldron2, win)
    draw(cauldron3, win)

    win.getMouse()
    win.close()
예제 #20
0
def test_justbackground():
    '''Create a window, draw the background into the window'''
    winW, winH = 500, 400
    win = gr.GraphWin('justbackground', 500, 400, False)

    background1 = background_init(0, 0, .5)
    background2 = background_init(100, 100, .75)
    background3 = background_init(300, 300, .25)

    draw(background1, win)
    draw(background2, win)
    draw(background3, win)

    win.getMouse()
    win.close()
예제 #21
0
def test_justplant():
    '''Create a window, draw the plant into the window'''
    winW, winH = 500, 400
    win = gr.GraphWin('justplant', 500, 400, False)

    plant1 = plant_init(150, 200, 1.3)
    plant2 = plant_init(100, 100, .75)
    plant3 = plant_init(300, 300, 1.0)

    draw(plant1, win)
    draw(plant2, win)
    draw(plant3, win)

    win.getMouse()
    win.close()
예제 #22
0
def test_justpotion():
    '''Create a window, draw the potion into the window'''
    winW, winH = 500, 400
    win = gr.GraphWin('justpotion', 500, 400, False)

    potion1 = potion_init(150, 200, 1.3)
    potion2 = potion_init(100, 100, .75)
    potion3 = potion_init(400, 300, 1.0)

    draw(potion1, win)
    draw(potion2, win)
    draw(potion3, win)

    win.getMouse()
    win.close()
예제 #23
0
def test_spaceship():
    '''Create a window, draw the spaceship into the window'''
    win = gr.GraphWin('Spaceship', 500, 400, False)

    spaceship = spaceship_init(250, 300, 1.0)

    draw(spaceship, win)

    for frame_num in range(100):
        time.sleep(0.25)
        spaceship_animate(spaceship, frame_num, win)
        if win.checkMouse():
            break

    win.getMouse()
    win.close()
예제 #24
0
def warhol(filename, listOfEffects):
    # read the image from the file use original=Image...
    # and get rows with Height, cols with Width...
    original = gr.Image(gr.Point(0, 0), filename)

    rows = original.getHeight()
    cols = original.getWidth()
    panels = len(listOfEffects)

    # create a window based on the image and how many copies which from the len(listOfEffects)
    win = gr.GraphWin('Warhol', cols * panels, rows)
    allimages = []

    # for each effect from the filter file swaprb, reduceGreen, whitecover

    for i in range(panels):
        # clone the original image
        clone = original.clone()  # duplicates the Image object
        # apply the filter to the clone, which filter to apply?
        if listOfEffects[i] == 'swaprb':
            filter.swaprb(clone)
        elif listOfEffects[i] == 'reduceGreen':
            filter.reduceGreen(clone)
        elif listOfEffects[i] == 'whitecover':
            filter.whitecover(clone)

        # move the image to the right location with their owner cols values
        clone.move(cols / 2 + i * cols, rows / 2)
        # draw the image into the window and append each copy into the images
        clone.draw(win)
        allimages.append(clone)

        # create some text at the last image center so the Points should be cols*2.5 and rows/2
    sometext = gr.Text(gr.Point(cols * 2.5, rows / 2), "hello world")
    sometext.setFill('red')
    sometext.setSize(20)
    sometext.draw(win)

    # create a red circle outline the text so the circle center is the same as above Points
    patch = gr.Circle(gr.Point(cols * 2.5, rows / 2), 80)
    patch.setOutline("red")
    patch.draw(win)

    # return the window and return all the images
    return win, allimages
예제 #25
0
def main():
    win = gr.GraphWin( 'balls colliding', 500, 500, False )

    ball1 = pho.Ball( win, 20 )
    ball2 = pho.Ball( win, 20 )
    ball1.setPosition( [200, 200] )
    ball2.setPosition( [300, 200] )

    # set up velocity and acceleration so they collide
    ball1.setVelocity( [200, 200] )
    ball2.setVelocity( [-200, 200] )
    ball1.setAcceleration( [0, -200] )
    ball2.setAcceleration( [0, -200] )
    ball1.draw()
    ball2.draw()

    txt = gr.Text( gr.Point( 250, 50), "Click to continue" )
    txt.setSize( 16 )
    txt.draw(win)
    win.getMouse()

    # loop for some time and check for collisions
    dt = 0.01
    for frame in range(120):
        if not coll.collision_ball_ball( ball1, ball2, dt ):
            ball1.update(dt)
        else:
            txt.setText( "Boom!" )

        if not coll.collision_ball_ball( ball2, ball1, dt ):
            ball2.update(dt)
        
        win.update()
        time.sleep(0.5*dt)
        if win.checkMouse() != None:
            break

    txt.setText('Click to quit')
    win.getMouse()

    txt.setText('See ya')
    win.update()
    time.sleep(0.2)
    
    win.close()
예제 #26
0
def main():
    k = int(sys.argv[1])  # scale control at terminal input

    win=g.GraphWin("My window", 1000, 600)
    test=com.riverboat(100, 300, k)
    for thing in test:
        thing.draw(win)

    test2=com.village(500, 300, k)
    for thing in test2:
        thing.draw(win)

    test2=com.village(100, 300, k)
    for thing in test2:
        thing.draw(win)

    test4 = com.init_birds(-50,0,2)
    for thing in test4:
        thing.draw(win)

    for i in range(30):
        test3=com.grass(100, 300, 1)
        for thing in test3:
          thing.draw(win)

    frame = 0
    while True:
        key = win.checkKey()
        if key == 'q':
            break
        if win.checkMouse() != None:
            break

        # call the birds animation fly to right and left
        com.animate_birds( test4, frame, win )
        # call the boats and river animation fly to right and left
        com.animate_riverboat(test, frame, win)
        # call the village animation fly to right and left
        com.animate_village(test2, frame, win)

        win.update()
        frame += 1

    win.getMouse()
    win.close()
예제 #27
0
def main(argv):
    # create a window
    win = gr.GraphWin("My window", 500, 500)

    print("argument1 ", argv[1])
    # create a circle
    c = gr.Circle(gr.Point(int(argv[2]), int(argv[3])), int(argv[1]))

    c.setFill(gr.color_rgb(100, 30, 100))

    # draw the circle inot the window
    c.draw(win)

    # pause until user gets mouse
    win.getMouse()
    win.close()

    return
예제 #28
0
def main():
    win = g.GraphWin("My window", 1000, 600)
    test = riverboat(100, 300, 1)
    for thing in test:
        thing.draw(win)

    test2 = village(500, 300, 1)
    for thing in test2:
        thing.draw(win)

    test2 = village(100, 300, 1)
    for thing in test2:
        thing.draw(win)

    test4 = init_birds(-50, 0, 2)
    for thing in test4:
        thing.draw(win)

    for i in range(30):
        test3 = grass(100, 300, 1)
        for thing in test3:
            thing.draw(win)

    frame = 0
    while True:
        key = win.checkKey()
        if key == 'q':
            break
        if win.checkMouse() != None:
            break

        # call the birds animation fly to right and left
        animate_birds(test4, frame, win)
        # call the boats and river animation fly to right and left
        animate_riverboat(test, frame, win)
        # call the village animation fly to right and left
        animate_village(test2, frame, win)

        win.update()
        frame += 1

    win.getMouse()
    win.close()
예제 #29
0
파일: gex.py 프로젝트: shiyong5008/testing
def interactive():

    win = gr.GraphWin( 'interactive demo', 500, 500, False )
    r = gr.Rectangle( gr.Point( 220, 260 ), gr.Point( 280, 240 ) )
    r.setOutline( 'purple' )
    r.setFill( 'pink' )
    r.setWidth( 3 )
    r.draw( win )

    counter = 0
    falling = None

    # begin event loop
    while True: # infinite loop

        if counter % 100 == 0:
            if falling != None:
                falling.undraw()
            falling = gr.Circle( gr.Point( random.randint(0, 500), 0 ), 10 )
            falling.setFill( 'blue' )
            falling.draw(win)

        if falling != None:
            falling.move( random.randint(-3, 3), 5 )

        counter += 1

        key = win.checkKey()
        if key == 'q':
            break
        elif key == 'a': # move left
            r.move( -20, 0 )
        elif key == 'w': # move up
            r.move( 0, -20 )
        elif key == 's': # move down
            r.move( 0, 20 )
        elif key == 'd': # move right
            r.move( 20, 0 )

        win.update() # manually update the window

    print("Terminating")
    win.close()
예제 #30
0
def warhol( filename, listOfEffects ):

    # read the image from the file
    original = gr.Image( gr.Point(0, 0), filename )

    rows = original.getHeight()
    cols = original.getWidth()
    panels = len(listOfEffects)

    # create a window based on the image and how many copies
    win = gr.GraphWin( 'Warhol', cols*panels, rows )
    allimages = []

    # for each effect
    for i in range(panels):
        # clone the original image
        clone = original.clone() # duplicates the Image object
        # apply the filter to the clone, which filter to apply?
        if listOfEffects[i] == 'swaprg': 
            image.swaprg( clone )
        elif listOfEffects[i] == 'reduceRed':
            image.reduceRed( clone )
        # implied else don't do anything
        
        # move the image to the right location
        clone.move( cols/2 + i*cols , rows/2 )
        # draw the image into the window
        clone.draw(win)
        allimages.append( clone )

        # create some text
        sometext = gr.Text( gr.Point( cols/2, rows/2+30 ), "Aaaaargh" )
        sometext.setFill('red')
        sometext.setSize( 20 )
        sometext.draw(win)

        # create an eye patch
        patch = gr.Circle( gr.Point( cols/2-15, rows/2-30 ), 8 )
        patch.setFill( 'black' )
        patch.draw(win)

    # return the window
    return win, allimages