# import everything
from tkinter import *

def main():

    # Call the Tk function which comes from tkinter 
    root = Tk()
    # root is an instance of class Tk, which is basicly
    # a window. 
    root.title("little window")
    # how big is it?
    root.geometry("600x400")

    # make a canvas object
    canvas = Canvas(root,width=600,height=400,bg="white")
    # put into window
    canvas.grid(column=0,row=0)

    # draw some stuff
    # one corner, then the opposite corner, then color
    canvas.create_rectangle(300,200,400,0,fill="lightGreen")
    canvas.create_oval(300,150,400,50,fill="darkRed")
    canvas.create_line(0,0,300,200,width=5)
    # can draw several line segments by putting
    # successive points into a list of tuples
    dataList = [(300,200),(400,300),(500,200)]
    canvas.create_line(dataList, width=5,fill="blue")

    # do GUI things - this actually brings up the window
    root.mainloop()
    print("window is now closed")

main()
