#1.py
 
#GraphWin is a class. Think of it as code that you can use to create
# GraphWin objects
 
#What is a GraphWin object? It is a particular instantiation of the class.
 
# For example if there was a class (i.e., code) to create student objects,
# you can use this class code to instantiate students Bill, Bob, and Tom
# Now Bill, Bob and Tom would be student objects.
 
# The GraphWin object is a graphics window. You acquire it from the
# graphics.py library, just like you got math.sqrt from math.py
 
# The Graphwin class has variables, and it uses those variables to give
# you different kinds of windows.
 
def wait():
    dummyvar = input (" ");
 
 
from graphics import *   #instead of just import, in which case you call
                         #functions using "graphics.GraphWin", like math.sqrt
                         #using this kind of import means no need to say
                         #"graphics." each time. Just GraphWin will do.
def main():
 
    wait()
    w1 = GraphWin("Small",200,200)      # (200,200) is default size
 
    wait()
    w2 = GraphWin("Medium",400,400)
 
    wait()
    w3 = GraphWin("Large",800,800)
 
    wait()
    w1.close()    #notice that w1,w2,w3 are objects and they each have methods
    w2.close()    #that can work with them. These "methods" are functions you 
    w3.close()    #call from the GraphWin class
 
    wait()
    for i in range(1,100,1):
 
      w = GraphWin("Oops! Yet another graphics window",10*i,10*i)
 
      # Note that w keeps getting reassigned to point to a new object as
      # the loop index changes
 
      #and note that we did not call the w.close() function to close windows
 
 
      # this was just to show you the windows
 
      # its bad programming practice to reassign w without closing the old w
 
      # w = GraphWin("Window 1",10,10)
      # now do a w.close()
      # or else when, without closing, you reassign variable w
      # w = GraphWin("Window 2",20,20)
 
      # you have lost the way to close the 10x10 window because w now
      # refers to the 20x20 window
 
      # so always be careful of your variables and losing information
 
main()
