# # file: slideshow.py # # This program does a small slide show, using # images and buttons from graphics import * def main(): win = GraphWin("Slide Show",800,600) win.setBackground('white') nextB = Rectangle(Point(600,550),Point(650,570)) nextB.setFill("green") nextBT = Text(Point(625,560),"NEXT") nextB.draw(win) nextBT.draw(win) flag = 1 # used to signal that the user click on "Exit" button exitB = Rectangle(Point(700,550),Point(750,570)) exitB.setFill("green") exitBT = Text(Point(725,560),"EXIT") exitB.draw(win) exitBT.draw(win) img1 = Image(Point(400,300),"tree-of-life.gif") img2 = Image(Point(400,300),"Celtic-tree-of-life.gif") img3 = Image(Point(400,300),"TreeOfLife.gif") img1.draw(win) counter = 1 while(flag != 0): c = win.getMouse() x = c.getX() y = c.getY() if 600 <= x <= 650 and 550<= y <=570: counter += 1 if counter % 3 == 1: img1.draw(win) if counter != 1: img3.undraw() elif counter % 3 == 2: img1.undraw() img2.draw(win) else: img2.undraw() img3.draw(win) elif 700 <= x <= 750 and 550<= y <=570: flag = 0 win.close() main()