#!/usr/local/bin/python ## # Button # ------ # This program creates a window and a quit button. It uses the # exitapp function to exit the program cleanly. # # The window and button are given a rectangle at creation time, # using the rect function. # # For most purposes you will want the third parameter to the # newwindow function to be StandardWindow. # # The show function causes the window to appear on the screen. ## from graphapp import * def quit(b): exitapp() def main(): w = newwindow("Pizza", rect(0,0,200,150), StandardWindow) b = newbutton("Quit", rect(10,10,80,30), quit) show(w) mainloop() main()