#!/usr/local/bin/python ## # Redraw # ------ # This program draws two rectangles in a window's call-back function. # If the window is redrawn for some reason, the rectangle will # automatically be redrawn. ## from graphapp import * def draw_window(w, win_rect): r = rect(10,10,80,10) setcolour(Red) drawrect(r) setcolour(Blue) fillrect(rect(10,40,80,10)) def main(): w = newwindow("Rectangles", rect(0,0,200,150), StandardWindow) setredraw(w, draw_window) show(w) mainloop() main()