# File: ChapterAnimation/rect0.py # When click draws a red rectnaglke that stays for 5 seconds from graphics import * import time def main(): win = GraphWin("Rect for 5 seconds") print("Canvas is", win.getWidth(),win.getHeight()) #default is 200x200 p = win.getMouse() # wait x ,y = p.getX(), p.getY() s = 25 #side of rect r,g,b = 200,100,25 R = Rectangle( Point(x,y), Point(x+s, y+s) ) R.setFill(color_rgb(r,g,b)) #square R.draw( win ) time.sleep( 5 ) #stays 5 seconds R.undraw() main()