#paintprogram.py
#Lucille Xiong
from random import *
from tkinter import *
from tkinter.filedialog import askopenfilename
from tkinter.filedialog import asksaveasfilename
from pygame import *
from math import *
font.init()
root=Tk() 
root.withdraw()
screen=display.set_mode((1000,750))
display.set_caption("Cut the Rope 2 Paint Program")
screen.fill((255,255,255))
#logo
logoPic=image.load("logo.png")
logoPic=transform.scale(logoPic,(266,100))
screen.blit(logoPic,(0,0))
#canvas
canvas=Rect(250,100,700,530)
draw.rect(screen,(255,255,255),canvas)
draw.rect(screen,(0,0,0),(249,99,702,532),1) #outlines the canvas
#help box
helpRect=Rect(800,10,150,80)
draw.rect(screen,(255,255,255),helpRect)
draw.rect(screen,(0,0,0),(799,9,152,82),1)#draw black outline around the helpRect
#font
tnmFont=font.SysFont("Times New Roman",15)
#starting help box
draw.rect(screen,(255,255,255),helpRect)
draw.rect(screen,(0,0,0),(799,9,152,82),1)
txtPic1=tnmFont.render("Pencil: Sketch with ease",True,(0,0,0))
txtPic2=tnmFont.render("Use mouse scroll to",True,(0,0,0))
txtPic3=tnmFont.render("change size.",True,(0,0,0))
screen.blit(txtPic1,(helpRect))
screen.blit(txtPic2,(800,25,150,80))
screen.blit(txtPic3,(800,40,150,80))
#music
init()
mixer.music.load("music1.mp3")
mixer.music.play()
musicplayRect=Rect(967,6,25,25)
musicpauseRect=Rect(967,38,25,25)
musicstopRect=Rect(967,69,25,25)
draw.rect(screen,(0,0,0),musicplayRect)
draw.rect(screen,(0,0,0),musicpauseRect)
draw.rect(screen,(0,0,0),musicstopRect)
music="" #decides whether the music should reload or unpause
#tools
tool="pencil"
pencilRect=Rect(25,100,50,50)
eraserRect=Rect(100,100,50,50)
brushRect=Rect(175,100,50,50)
eyedropperRect=Rect(25,160,50,50)
rectunRect=Rect(100,160,50,50) #unfilled rectangle
ellipseunRect=Rect(175,160,50,50) #unfilled ellipse
sprayRect=Rect(25,220,50,50)
rectfillRect=Rect(100,220,50,50) #filled rectangle
ellipsefillRect=Rect(175,220,50,50) #filled ellipse
clearRect=Rect(25,280,50,50)
lineRect=Rect(100,280,50,50)
polyRect=Rect(175,280,50,50)
undoRect=Rect(25,340,50,50)
saveRect=Rect(100,340,50,50)
loadRect=Rect(175,340,50,50)
redoRect=Rect(25,400,50,50)
#draws the tool's rect
draw.rect(screen,(0,0,0),pencilRect)
draw.rect(screen,(0,0,0),eraserRect)
draw.rect(screen,(0,0,0),brushRect)
draw.rect(screen,(0,0,0),eyedropperRect)
draw.rect(screen,(0,0,0),rectunRect)
draw.rect(screen,(0,0,0),ellipseunRect)
draw.rect(screen,(0,0,0),sprayRect)
draw.rect(screen,(0,0,0),rectfillRect)
draw.rect(screen,(0,0,0),ellipsefillRect)
draw.rect(screen,(0,0,0),clearRect)
draw.rect(screen,(0,0,0),lineRect)
draw.rect(screen,(0,0,0),polyRect)
draw.rect(screen,(0,0,0),undoRect)
draw.rect(screen,(0,0,0),loadRect)
draw.rect(screen,(0,0,0),saveRect)
draw.rect(screen,(0,0,0),redoRect)
#tools' picture
backgroundPic=image.load("background.png") #the green background of all the tools
backgroundPic=transform.scale(backgroundPic,(50,50))
musicbackgroundPic=transform.scale(backgroundPic,(25,25)) #use for the music buttons
screen.blit(backgroundPic,(25,100))
screen.blit(backgroundPic,(100,100))
screen.blit(backgroundPic,(175,100))
screen.blit(backgroundPic,(25,160))
screen.blit(backgroundPic,(100,160))
screen.blit(backgroundPic,(175,160))
screen.blit(backgroundPic,(25,220))
screen.blit(backgroundPic,(100,220))
screen.blit(backgroundPic,(175,220))
screen.blit(backgroundPic,(25,280))
screen.blit(backgroundPic,(100,280))
screen.blit(backgroundPic,(175,280))
screen.blit(backgroundPic,(25,340))
screen.blit(backgroundPic,(100,340))
screen.blit(backgroundPic,(175,340))
screen.blit(backgroundPic,(25,400))
screen.blit(musicbackgroundPic,(967,6))
screen.blit(musicbackgroundPic,(967,38))
screen.blit(musicbackgroundPic,(967,69))
#tools pictures
pencilPic=image.load("pencil.png")
pencilPic=transform.scale(pencilPic,(43,43))
screen.blit(pencilPic,(27,102))
draw.rect(screen,(0,0,0),(23,98,52,52),2) #shows the beginning selected tool
eraserPic=image.load("eraser.png")
eraserPic=transform.scale(eraserPic,(45,45))
screen.blit(eraserPic,(102,102))
brushPic=image.load("brush.png")
brushPic=transform.scale(brushPic,(45,42))
screen.blit(brushPic,(177,102))
eyedropperPic=image.load("eyedropper.png")
eyedropperPic=transform.scale(eyedropperPic,(42,42))
screen.blit(eyedropperPic,(28,163))
rectunPic=image.load("unfilledrect.png")
rectunPic=transform.scale(rectunPic,(38,25))
screen.blit(rectunPic,(106,172))
ellipseunPic=image.load("unfilledellipse.png")
ellipseunPic=transform.scale(ellipseunPic,(38,25))
screen.blit(ellipseunPic,(181,172))
sprayPic=image.load("spraypaint.png")
sprayPic=transform.scale(sprayPic,(45,45))
screen.blit(sprayPic,(31,221))
rectfillPic=image.load("filledrect.png")
rectfillPic=transform.scale(rectfillPic,(38,25))
screen.blit(rectfillPic,(106,232))
ellipsefillPic=image.load("filledellipse.png")
ellipsefillPic=transform.scale(ellipsefillPic,(38,25))
screen.blit(ellipsefillPic,(181,232))
clearPic=image.load("clear.png")
clearPic=transform.scale(clearPic,(45,45))
screen.blit(clearPic,(26,284))
linePic=image.load("line.png")
linePic=transform.scale(linePic,(42,42))
screen.blit(linePic,(103,282))
polyPic=image.load("polygon.png")
polyPic=transform.scale(polyPic,(43,45))
screen.blit(polyPic,(178,282))
undoPic=image.load("undo.png")
undoPic=transform.scale(undoPic,(45,45))
screen.blit(undoPic,(28,342))
savePic=image.load("save.png")
savePic=transform.scale(savePic,(40,40))
screen.blit(savePic,(104,344))
loadPic=image.load("load.png")
loadPic=transform.scale(loadPic,(42,45))
screen.blit(loadPic,(178,342))
redoPic=image.load("redo.png")
redoPic=transform.scale(redoPic,(45,45))
screen.blit(redoPic,(28,402))
playPic=image.load("play.png")
playPic=transform.scale(playPic,(23,23))
screen.blit(playPic,(968,7))
pausePic=image.load("pause.png")
pausePic=transform.scale(pausePic,(23,23))
screen.blit(pausePic,(968,39))
stopPic=image.load("stop.png")
stopPic=transform.scale(stopPic,(23,23))
screen.blit(stopPic,(968,70))
#size
drawSize=1
#colour
drawColour=(0,0,0)
colourPic=image.load("Colour.png")
colourPic=transform.scale(colourPic,(200,150))
colourRect=Rect(25,480,200,150)
draw.rect(screen,(0,0,0),colourRect)
screen.blit(colourPic,(25,480))
#stamps
#loading and resizing stamps
omnomPic=image.load("omnom.png")
rotoPic=image.load("roto.png")
lickPic=image.load("lick.png")
bluePic=image.load("blue.png")
tossPic=image.load("toss.png")
booPic=image.load("boo.png")
omnomPic=transform.scale(omnomPic,(100,100))
omnomRect=Rect(250,640,100,100)
rotoPic=transform.scale(rotoPic,(100,100))
rotoRect=Rect(370,640,100,100)
lickPic=transform.scale(lickPic,(100,100))
lickRect=Rect(490,640,100,100)
bluePic=transform.scale(bluePic,(100,100))
blueRect=Rect(610,640,100,100)
tossPic=transform.scale(tossPic,(100,100))
tossRect=Rect(730,640,100,100)
booPic=transform.scale(booPic,(100,100))
booRect=Rect(850,640,100,100)
#blits the stamps
draw.rect(screen,(255,255,255),omnomRect)
draw.rect(screen,(0,0,0),(249,639,102,102),1) #outlines the Rect
screen.blit(omnomPic,(250,640))
draw.rect(screen,(255,255,255),rotoRect)
draw.rect(screen,(0,0,0),(369,639,102,102),1)
screen.blit(rotoPic,(370,640))
draw.rect(screen,(255,255,255),lickRect)
draw.rect(screen,(0,0,0),(489,639,102,102),1)
screen.blit(lickPic,(490,640))
draw.rect(screen,(255,255,255),blueRect)
draw.rect(screen,(0,0,0),(609,639,102,102),1)
screen.blit(bluePic,(610,640))
draw.rect(screen,(255,255,255),tossRect)
draw.rect(screen,(0,0,0),(729,639,102,102),1)
screen.blit(tossPic,(730,640))
draw.rect(screen,(255,255,255),booRect)
draw.rect(screen,(0,0,0),(849,639,102,102),1)
screen.blit(booPic,(850,640))
#selected size/colour
selectRect=Rect(102,645,60,60)
draw.rect(screen,(0,0,0),(101,644,62,62)) #outlines the rect
#mouse position rect
positionRect=Rect(102,726,60,15)
draw.rect(screen,(0,0,0),(101,725,62,17),1)
#undo/redo
undo=[]
redo=[]
#polygon tool
polypoints=[]
polydrawn=False
done=False #used for loading pictures from computer
click=False #used for undo and redo
#design
design1=image.load("design1.png")
design1=transform.scale(design1,(79,75))
screen.blit(design1,(718,15))
#paint word

running=True
while running:
    click=False
    for e in event.get():
        if e.type==QUIT:
            running=False
        if e.type==MOUSEBUTTONDOWN:
            click=True
            start=e.pos #usedin line tool
            start1,start2=e.pos #used in shapes
            copy=screen.copy()
            if e.button==4: #size of the tool
               drawSize+=1  #affects pencil, eraser, brush, spray paint, unfilled rect, unfiled ellipse, polygon
            if e.button==5:
               drawSize-=1
        if e.type==MOUSEBUTTONUP:
            if e.button==1 and canvas.collidepoint(mx,my):
                undo.append(screen.subsurface(canvas).copy())
                redo=[]
    mx,my=mouse.get_pos()
    mb=mouse.get_pressed()
    #limits the size of all the tools
    if drawSize<=0:
        drawSize=1
    if drawSize>25:
        drawSize=25
    #limits the size of specific tools
    if tool=="pencil" and drawSize>5:
        drawSize=5
    if tool=="polygon" and drawSize>10:
        drawSize=10
    if tool=="unfilled ellipse" and drawSize>3:
        drawSize=3
    if tool=="spray paint" and drawSize<8:
        drawSize=8
    #draws selcted size/colour
    draw.rect(screen,(255,255,255),selectRect)
    draw.circle(screen,drawColour,(132,675),drawSize)
    #mouse position
    mxlocation=str(mx)
    mylocation=str(my)
    draw.rect(screen,(255,255,255),positionRect)
    positionPic=tnmFont.render((mxlocation+","+mylocation),True,(0,0,0))
    screen.blit(positionPic,(106,726,60,15))
    #Remembers selected tool
    if mb[0]==1 and pencilRect.collidepoint((mx,my)):
        tool="pencil"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(0,0,0),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Pencil: Sketch with ease",True,(0,0,0))
        txtPic2=tnmFont.render("Use mouse scroll to",True,(0,0,0))
        txtPic3=tnmFont.render("change size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and eraserRect.collidepoint((mx,my)):
        tool="eraser"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(0,0,0),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Eraser: To erase",True,(0,0,0))
        txtPic2=tnmFont.render("mistakes.Use scroll",True,(0,0,0))
        txtPic3=tnmFont.render("button to change size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and brushRect.collidepoint((mx,my)):
        tool="brush"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(0,0,0),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Brush: Draws smooth",True,(0,0,0))
        txtPic2=tnmFont.render("lines. Use mouse",True,(0,0,0))
        txtPic3=tnmFont.render("scroll to change size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and eyedropperRect.collidepoint((mx,my)):
        tool="eyedropper"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(0,0,0),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Eyedropper: Selects",True,(0,0,0))
        txtPic2=tnmFont.render("colour on canvas.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
    elif mb[0]==1 and rectunRect.collidepoint((mx,my)):
        tool="unfilled rectangle"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(0,0,0),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Unfilled Rectangle:",True,(0,0,0))
        txtPic2=tnmFont.render("Drag to draw the",True,(0,0,0))
        txtPic3=tnmFont.render("rectangle border. Use",True,(0,0,0))
        txtPic4=tnmFont.render("mouse scroll to",True,(0,0,0))
        txtPic5=tnmFont.render("change border size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        screen.blit(txtPic4,(800,55,150,80))
        screen.blit(txtPic5,(800,70,150,80))
    elif mb[0]==1 and ellipseunRect.collidepoint((mx,my)):
        tool="unfilled ellipse"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(0,0,0),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Unfilled Ellipse:",True,(0,0,0))
        txtPic2=tnmFont.render("Drag to draw the",True,(0,0,0))
        txtPic3=tnmFont.render("ellipse border. Use",True,(0,0,0))
        txtPic4=tnmFont.render("mouse scroll to",True,(0,0,0))
        txtPic5=tnmFont.render("change border size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        screen.blit(txtPic4,(800,55,150,80))
        screen.blit(txtPic5,(800,70,150,80))
    elif mb[0]==1 and sprayRect.collidepoint((mx,my)):
        tool="spray paint"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(0,0,0),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box 
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Spray Paint: Creates",True,(0,0,0))
        txtPic2=tnmFont.render("an airbrush affect.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
    elif mb[0]==1 and rectfillRect.collidepoint((mx,my)):
        tool="filled rectangle"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(0,0,0),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Filled Rectangle: Drag",True,(0,0,0))
        txtPic2=tnmFont.render("to draw a filled",True,(0,0,0))
        txtPic3=tnmFont.render("rectangle.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and ellipsefillRect.collidepoint((mx,my)):
        tool="filled ellipse"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(0,0,0),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Filled Ellipse: Drag",True,(0,0,0))
        txtPic2=tnmFont.render("to draw a filled",True,(0,0,0))
        txtPic3=tnmFont.render("ellipse.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and clearRect.collidepoint((mx,my)):
        tool="clear"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(0,0,0),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        draw.rect(screen,(255,255,255),canvas)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Clear: Clears the canvas.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
    elif mb[0]==1 and lineRect.collidepoint((mx,my)):
        tool="line"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(0,0,0),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Line: Drag to draw",True,(0,0,0))
        txtPic2=tnmFont.render("a line. Use mouse",True,(0,0,0))
        txtPic3=tnmFont.render("scroll to change size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and polyRect.collidepoint((mx,my)):
        tool="polygon"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(0,0,0),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Polygon: Left click to",True,(0,0,0))
        txtPic2=tnmFont.render("add a vertex. Right click",True,(0,0,0))
        txtPic3=tnmFont.render("to draw the polygon.",True,(0,0,0))
        txtPic4=tnmFont.render("Use mouse scroll to",True,(0,0,0))
        txtPic5=tnmFont.render("change border size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        screen.blit(txtPic4,(800,55,150,80))
        screen.blit(txtPic5,(800,70,150,80))
    elif mb[0]==1 and undoRect.collidepoint((mx,my)):
        tool="undo"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(0,0,0),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Undo: Erases last",True,(0,0,0))
        txtPic2=tnmFont.render("change done.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        if len(undo)>1 and click:
            redo.append(undo.pop())
            screen.blit(undo[-1],(250,100))
    elif mb[0]==1 and saveRect.collidepoint((mx,my)):
        tool="save"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(0,0,0),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Save: Save the canvas",True,(0,0,0))
        txtPic2=tnmFont.render("on your computer.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        fileName=asksaveasfilename(parent=root,title="Save the image as...")
        if len(fileName)>0:
            if ".png" or ".jpg" or ".bmp" not in filename: #if image type is specified add .png 
                fileName+=".png"
            image.save(screen.subsurface(canvas),fileName)
    elif mb[0]==1 and loadRect.collidepoint((mx,my)):
        tool="load"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(0,0,0),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Load: Click on canvas",True,(0,0,0))
        txtPic2=tnmFont.render("to load a picture",True,(0,0,0))
        txtPic3=tnmFont.render("from your computer.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        fileName=askopenfilename(parent=root,title="Open Image:")
        if len(fileName)>0:
            loadPic=image.load(fileName)
            done=True
    elif mb[0]==1 and redoRect.collidepoint((mx,my)):
        tool="redo"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(0,0,0),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Redo: Undoes the last",True,(0,0,0))
        txtPic2=tnmFont.render("undo change.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        if len(redo)>0 and click:
            screen.blit(redo[-1],(250,100))
            undo.append(redo.pop())
    elif mb[0]==1 and omnomRect.collidepoint((mx,my)):
        tool="omnom stamp"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(0,0,0),(248,638,102,102),2)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("OmNom Stamp: Click",True,(0,0,0))
        txtPic2=tnmFont.render("on canvas to stamp",True,(0,0,0))
        txtPic3=tnmFont.render("image.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and rotoRect.collidepoint((mx,my)):
        tool="roto stamp"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(0,0,0),(368,638,102,102),2)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Roto Stamp: Click",True,(0,0,0))
        txtPic2=tnmFont.render("on canvas to stamp",True,(0,0,0))
        txtPic3=tnmFont.render("image.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and lickRect.collidepoint((mx,my)):
        tool="lick stamp"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(0,0,0),(488,638,102,102),2)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Lick Stamp: Click",True,(0,0,0))
        txtPic2=tnmFont.render("on canvas to stamp",True,(0,0,0))
        txtPic3=tnmFont.render("image.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and blueRect.collidepoint((mx,my)):
        tool="blue stamp"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(0,0,0),(608,638,102,102),2)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Blue Stamp: Click",True,(0,0,0))
        txtPic2=tnmFont.render("on canvas to stamp",True,(0,0,0))
        txtPic3=tnmFont.render("image.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and tossRect.collidepoint((mx,my)):
        tool="toss stamp"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(0,0,0),(728,638,102,102),2)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Toss Stamp: Click",True,(0,0,0))
        txtPic2=tnmFont.render("on canvas to stamp",True,(0,0,0))
        txtPic3=tnmFont.render("image.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and booRect.collidepoint((mx,my)):
        tool="boo stamp"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(0,0,0),(848,638,102,102),2)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Boo Stamp: Click",True,(0,0,0))
        txtPic2=tnmFont.render("on canvas to stamp",True,(0,0,0))
        txtPic3=tnmFont.render("image.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and musicplayRect.collidepoint((mx,my)):
        if music=="pause": #if the music was paused, it will unpause
            mixer.music.unpause()
        elif music=="stop": #if the music was stopped, it will restart
            mixer.music.play()
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Music: Play button",True,(0,0,0))
        txtPic2=tnmFont.render("starts the music. Pause",True,(0,0,0))
        txtPic3=tnmFont.render("button temporarily stops",True,(0,0,0))
        txtPic4=tnmFont.render("the music. Stop button",True,(0,0,0))
        txtPic5=tnmFont.render("stops the music.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        screen.blit(txtPic4,(800,55,150,80))
        screen.blit(txtPic5,(800,70,150,80))
    elif mb[0]==1 and musicpauseRect.collidepoint((mx,my)):
        mixer.music.pause()
        music="pause"
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Music: Play button",True,(0,0,0))
        txtPic2=tnmFont.render("starts the music. Pause",True,(0,0,0))
        txtPic3=tnmFont.render("button temporarily stops",True,(0,0,0))
        txtPic4=tnmFont.render("the music. Stop button",True,(0,0,0))
        txtPic5=tnmFont.render("stops the music.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        screen.blit(txtPic4,(800,55,150,80))
        screen.blit(txtPic5,(800,70,150,80))
    elif mb[0]==1 and musicstopRect.collidepoint((mx,my)):
        mixer.music.stop()
        music="stop"
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Music: Play button",True,(0,0,0))
        txtPic2=tnmFont.render("starts the music. Pause",True,(0,0,0))
        txtPic3=tnmFont.render("button temporarily stops",True,(0,0,0))
        txtPic4=tnmFont.render("the music. Stop button",True,(0,0,0))
        txtPic5=tnmFont.render("stops the music.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        screen.blit(txtPic4,(800,55,150,80))
        screen.blit(txtPic5,(800,70,150,80))
    #colour
    if mb[0]==1 and colourRect.collidepoint((mx,my)):
        drawColour=screen.get_at((mx,my))
    #Using the tools
    if mb[0]==1 and canvas.collidepoint((mx,my)):
        screen.set_clip(canvas)
        if tool=="pencil":
            draw.line(screen,drawColour,(oldmx,oldmy),(mx,my),drawSize)
        elif tool=="eraser":
            dist=hypot(oldmx-mx,oldmy-my)
            dist=max(1,dist)
            for i in range(int(dist)):
                x=int(mx+i/dist*(oldmx-mx))
                y=int(my+i/dist*(oldmy-my))
                draw.circle(screen,(255,255,255),(x,y),drawSize)
        elif tool=="brush":
            dist=hypot(oldmx-mx,oldmy-my) #hypotenuse of the right triangle
            dist=max(1,dist)
            for i in range(int(dist)): 
                x=int(mx+i/dist*(oldmx-mx))
                y=int(my+i/dist*(oldmy-my)) #finds each pixel location
                draw.circle(screen,drawColour,(x,y),drawSize)
        elif tool=="eyedropper":
            drawColour=screen.get_at((mx,my))
            tool=oldtool
        elif tool=="unfilled ellipse":
            screen.blit(copy,(0,0))
            sx,sy=(min(mx,start1),min(my,start2)) #ensures that the width and length are not negative
            width=(max(mx,start1))-sx
            length=(max(my,start2))-sy
            if min(width,length)<drawSize*2:
                draw.ellipse(screen,drawColour,(sx,sy,width,length)) #fills the ellipse if drawSize exceeds the rect
            else:
                draw.ellipse(screen,drawColour,(sx,sy,width,length),drawSize)
        elif tool=="unfilled rectangle":
            screen.blit(copy,(0,0))
            width=mx-start1
            length=my-start2
            rec=Rect(start1,start2,width,length)
            draw.rect(screen,drawColour,rec,drawSize)
            #draws smaller rectangles to fill in the blank space made by draw.rect
            draw.rect(screen,drawColour,(start1-drawSize/2+1,start2-drawSize/2+1,drawSize,drawSize))
            draw.rect(screen,drawColour,(start1-drawSize/2+1,start2+length-drawSize/2,drawSize,drawSize))
            draw.rect(screen,drawColour,(start1+width-drawSize/2,start2-drawSize/2+1,drawSize,drawSize))
            draw.rect(screen,drawColour,(start1+width-drawSize/2,start2+length-drawSize/2,drawSize,drawSize))
        elif tool=="spray paint":
            for i in range(6):
                randmx,randmy=(randint(mx-drawSize,mx+drawSize),randint(my-drawSize,my+drawSize)) #generates random values
                if hypot(randmx-mx,randmy-my)<drawSize:
                    draw.circle(screen,drawColour,(randmx,randmy),0)
        elif tool=="filled ellipse":
            screen.blit(copy,(0,0))
            sx,sy=min(mx,start1),min(my,start2)
            width=(max(mx,start1))-sx
            length=(max(my,start2))-sy
            ellipse=Rect(sx,sy,width,length)
            draw.ellipse(screen,drawColour,ellipse)
        elif tool=="filled rectangle":
            screen.blit(copy,(0,0))
            width=mx-start1
            length=my-start2
            rec=Rect(start1,start2,width,length)
            draw.rect(screen,drawColour,rec)
        elif tool=="line":
            screen.blit(copy,(0,0))
            draw.line(screen,drawColour,start,(mx,my),drawSize)
        elif tool=="polygon":
            if polydrawn==True:
                polypoints=[]
                polydrawn=False
            if (mx,my) in polypoints:
                pass
            else:
                polypoints.append((mx,my))
        elif tool=="load":
            #the user clicks on the canvas to blit the picture
            if done:
                screen.blit(copy,(0,0))
                screen.blit(loadPic,(mx,my))
                done=False
        elif tool=="omnom stamp":
            screen.blit(copy,(0,0))
            screen.blit(omnomPic,(mx-45,my-50))
        elif tool=="roto stamp":
            screen.blit(copy,(0,0))
            screen.blit(rotoPic,(mx-45,my-50))
        elif tool=="lick stamp":
            screen.blit(copy,(0,0))
            screen.blit(lickPic,(mx-45,my-50))
        elif tool=="blue stamp":
            screen.blit(copy,(0,0))
            screen.blit(bluePic,(mx-45,my-50))
        elif tool=="toss stamp":
            screen.blit(copy,(0,0))
            screen.blit(tossPic,(mx-45,my-50))
        elif tool=="boo stamp":
            screen.blit(copy,(0,0))
            screen.blit(booPic,(mx-45,my-50))
        screen.set_clip(None)
    if mb[2]==1 and canvas.collidepoint((mx,my)):
        screen.set_clip(canvas)
        if tool=="polygon":
            draw.polygon(screen,drawColour,polypoints,drawSize) #when the user right clicks the polygon is drawn
            polydrawn=True
        screen.set_clip(None)
    oldmx,oldmy=mx,my
    if tool!="eyedropper":
        oldtool=tool
    display.flip()
font.quit()
del tnmFont
quit()

7e8a3ff2ba9cb263e87dc4b03800357ef8ee37c4
<mask token>

<mask token>
font.init()
<mask token>
root.withdraw()
<mask token>
display.set_caption('Cut the Rope 2 Paint Program')
screen.fill((255, 255, 255))
<mask token>
screen.blit(logoPic, (0, 0))
<mask token>
draw.rect(screen, (255, 255, 255), canvas)
draw.rect(screen, (0, 0, 0), (249, 99, 702, 532), 1)
<mask token>
draw.rect(screen, (255, 255, 255), helpRect)
draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
<mask token>
draw.rect(screen, (255, 255, 255), helpRect)
draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
<mask token>
screen.blit(txtPic1, helpRect)
screen.blit(txtPic2, (800, 25, 150, 80))
screen.blit(txtPic3, (800, 40, 150, 80))
init()
mixer.music.load('music1.mp3')
mixer.music.play()
<mask token>
draw.rect(screen, (0, 0, 0), musicplayRect)
draw.rect(screen, (0, 0, 0), musicpauseRect)
draw.rect(screen, (0, 0, 0), musicstopRect)
<mask token>
draw.rect(screen, (0, 0, 0), pencilRect)
draw.rect(screen, (0, 0, 0), eraserRect)
draw.rect(screen, (0, 0, 0), brushRect)
draw.rect(screen, (0, 0, 0), eyedropperRect)
draw.rect(screen, (0, 0, 0), rectunRect)
draw.rect(screen, (0, 0, 0), ellipseunRect)
draw.rect(screen, (0, 0, 0), sprayRect)
draw.rect(screen, (0, 0, 0), rectfillRect)
draw.rect(screen, (0, 0, 0), ellipsefillRect)
draw.rect(screen, (0, 0, 0), clearRect)
draw.rect(screen, (0, 0, 0), lineRect)
draw.rect(screen, (0, 0, 0), polyRect)
draw.rect(screen, (0, 0, 0), undoRect)
draw.rect(screen, (0, 0, 0), loadRect)
draw.rect(screen, (0, 0, 0), saveRect)
draw.rect(screen, (0, 0, 0), redoRect)
<mask token>
screen.blit(backgroundPic, (25, 100))
screen.blit(backgroundPic, (100, 100))
screen.blit(backgroundPic, (175, 100))
screen.blit(backgroundPic, (25, 160))
screen.blit(backgroundPic, (100, 160))
screen.blit(backgroundPic, (175, 160))
screen.blit(backgroundPic, (25, 220))
screen.blit(backgroundPic, (100, 220))
screen.blit(backgroundPic, (175, 220))
screen.blit(backgroundPic, (25, 280))
screen.blit(backgroundPic, (100, 280))
screen.blit(backgroundPic, (175, 280))
screen.blit(backgroundPic, (25, 340))
screen.blit(backgroundPic, (100, 340))
screen.blit(backgroundPic, (175, 340))
screen.blit(backgroundPic, (25, 400))
screen.blit(musicbackgroundPic, (967, 6))
screen.blit(musicbackgroundPic, (967, 38))
screen.blit(musicbackgroundPic, (967, 69))
<mask token>
screen.blit(pencilPic, (27, 102))
draw.rect(screen, (0, 0, 0), (23, 98, 52, 52), 2)
<mask token>
screen.blit(eraserPic, (102, 102))
<mask token>
screen.blit(brushPic, (177, 102))
<mask token>
screen.blit(eyedropperPic, (28, 163))
<mask token>
screen.blit(rectunPic, (106, 172))
<mask token>
screen.blit(ellipseunPic, (181, 172))
<mask token>
screen.blit(sprayPic, (31, 221))
<mask token>
screen.blit(rectfillPic, (106, 232))
<mask token>
screen.blit(ellipsefillPic, (181, 232))
<mask token>
screen.blit(clearPic, (26, 284))
<mask token>
screen.blit(linePic, (103, 282))
<mask token>
screen.blit(polyPic, (178, 282))
<mask token>
screen.blit(undoPic, (28, 342))
<mask token>
screen.blit(savePic, (104, 344))
<mask token>
screen.blit(loadPic, (178, 342))
<mask token>
screen.blit(redoPic, (28, 402))
<mask token>
screen.blit(playPic, (968, 7))
<mask token>
screen.blit(pausePic, (968, 39))
<mask token>
screen.blit(stopPic, (968, 70))
<mask token>
draw.rect(screen, (0, 0, 0), colourRect)
screen.blit(colourPic, (25, 480))
<mask token>
draw.rect(screen, (255, 255, 255), omnomRect)
draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
screen.blit(omnomPic, (250, 640))
draw.rect(screen, (255, 255, 255), rotoRect)
draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
screen.blit(rotoPic, (370, 640))
draw.rect(screen, (255, 255, 255), lickRect)
draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
screen.blit(lickPic, (490, 640))
draw.rect(screen, (255, 255, 255), blueRect)
draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
screen.blit(bluePic, (610, 640))
draw.rect(screen, (255, 255, 255), tossRect)
draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
screen.blit(tossPic, (730, 640))
draw.rect(screen, (255, 255, 255), booRect)
draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
screen.blit(booPic, (850, 640))
<mask token>
draw.rect(screen, (0, 0, 0), (101, 644, 62, 62))
<mask token>
draw.rect(screen, (0, 0, 0), (101, 725, 62, 17), 1)
<mask token>
screen.blit(design1, (718, 15))
<mask token>
while running:
    click = False
    for e in event.get():
        if e.type == QUIT:
            running = False
        if e.type == MOUSEBUTTONDOWN:
            click = True
            start = e.pos
            start1, start2 = e.pos
            copy = screen.copy()
            if e.button == 4:
                drawSize += 1
            if e.button == 5:
                drawSize -= 1
        if e.type == MOUSEBUTTONUP:
            if e.button == 1 and canvas.collidepoint(mx, my):
                undo.append(screen.subsurface(canvas).copy())
                redo = []
    mx, my = mouse.get_pos()
    mb = mouse.get_pressed()
    if drawSize <= 0:
        drawSize = 1
    if drawSize > 25:
        drawSize = 25
    if tool == 'pencil' and drawSize > 5:
        drawSize = 5
    if tool == 'polygon' and drawSize > 10:
        drawSize = 10
    if tool == 'unfilled ellipse' and drawSize > 3:
        drawSize = 3
    if tool == 'spray paint' and drawSize < 8:
        drawSize = 8
    draw.rect(screen, (255, 255, 255), selectRect)
    draw.circle(screen, drawColour, (132, 675), drawSize)
    mxlocation = str(mx)
    mylocation = str(my)
    draw.rect(screen, (255, 255, 255), positionRect)
    positionPic = tnmFont.render(mxlocation + ',' + mylocation, True, (0, 0, 0)
        )
    screen.blit(positionPic, (106, 726, 60, 15))
    if mb[0] == 1 and pencilRect.collidepoint((mx, my)):
        tool = 'pencil'
        draw.rect(screen, (0, 0, 0), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Pencil: Sketch with ease', True, (0, 0, 0))
        txtPic2 = tnmFont.render('Use mouse scroll to', True, (0, 0, 0))
        txtPic3 = tnmFont.render('change size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and eraserRect.collidepoint((mx, my)):
        tool = 'eraser'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Eraser: To erase', True, (0, 0, 0))
        txtPic2 = tnmFont.render('mistakes.Use scroll', True, (0, 0, 0))
        txtPic3 = tnmFont.render('button to change size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and brushRect.collidepoint((mx, my)):
        tool = 'brush'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Brush: Draws smooth', True, (0, 0, 0))
        txtPic2 = tnmFont.render('lines. Use mouse', True, (0, 0, 0))
        txtPic3 = tnmFont.render('scroll to change size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and eyedropperRect.collidepoint((mx, my)):
        tool = 'eyedropper'
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Eyedropper: Selects', True, (0, 0, 0))
        txtPic2 = tnmFont.render('colour on canvas.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
    elif mb[0] == 1 and rectunRect.collidepoint((mx, my)):
        tool = 'unfilled rectangle'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Unfilled Rectangle:', True, (0, 0, 0))
        txtPic2 = tnmFont.render('Drag to draw the', True, (0, 0, 0))
        txtPic3 = tnmFont.render('rectangle border. Use', True, (0, 0, 0))
        txtPic4 = tnmFont.render('mouse scroll to', True, (0, 0, 0))
        txtPic5 = tnmFont.render('change border size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and ellipseunRect.collidepoint((mx, my)):
        tool = 'unfilled ellipse'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Unfilled Ellipse:', True, (0, 0, 0))
        txtPic2 = tnmFont.render('Drag to draw the', True, (0, 0, 0))
        txtPic3 = tnmFont.render('ellipse border. Use', True, (0, 0, 0))
        txtPic4 = tnmFont.render('mouse scroll to', True, (0, 0, 0))
        txtPic5 = tnmFont.render('change border size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and sprayRect.collidepoint((mx, my)):
        tool = 'spray paint'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Spray Paint: Creates', True, (0, 0, 0))
        txtPic2 = tnmFont.render('an airbrush affect.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
    elif mb[0] == 1 and rectfillRect.collidepoint((mx, my)):
        tool = 'filled rectangle'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Filled Rectangle: Drag', True, (0, 0, 0))
        txtPic2 = tnmFont.render('to draw a filled', True, (0, 0, 0))
        txtPic3 = tnmFont.render('rectangle.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and ellipsefillRect.collidepoint((mx, my)):
        tool = 'filled ellipse'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Filled Ellipse: Drag', True, (0, 0, 0))
        txtPic2 = tnmFont.render('to draw a filled', True, (0, 0, 0))
        txtPic3 = tnmFont.render('ellipse.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and clearRect.collidepoint((mx, my)):
        tool = 'clear'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), canvas)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Clear: Clears the canvas.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
    elif mb[0] == 1 and lineRect.collidepoint((mx, my)):
        tool = 'line'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Line: Drag to draw', True, (0, 0, 0))
        txtPic2 = tnmFont.render('a line. Use mouse', True, (0, 0, 0))
        txtPic3 = tnmFont.render('scroll to change size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and polyRect.collidepoint((mx, my)):
        tool = 'polygon'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Polygon: Left click to', True, (0, 0, 0))
        txtPic2 = tnmFont.render('add a vertex. Right click', True, (0, 0, 0))
        txtPic3 = tnmFont.render('to draw the polygon.', True, (0, 0, 0))
        txtPic4 = tnmFont.render('Use mouse scroll to', True, (0, 0, 0))
        txtPic5 = tnmFont.render('change border size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and undoRect.collidepoint((mx, my)):
        tool = 'undo'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Undo: Erases last', True, (0, 0, 0))
        txtPic2 = tnmFont.render('change done.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        if len(undo) > 1 and click:
            redo.append(undo.pop())
            screen.blit(undo[-1], (250, 100))
    elif mb[0] == 1 and saveRect.collidepoint((mx, my)):
        tool = 'save'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Save: Save the canvas', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on your computer.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        fileName = asksaveasfilename(parent=root, title='Save the image as...')
        if len(fileName) > 0:
            if '.png' or '.jpg' or '.bmp' not in filename:
                fileName += '.png'
            image.save(screen.subsurface(canvas), fileName)
    elif mb[0] == 1 and loadRect.collidepoint((mx, my)):
        tool = 'load'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Load: Click on canvas', True, (0, 0, 0))
        txtPic2 = tnmFont.render('to load a picture', True, (0, 0, 0))
        txtPic3 = tnmFont.render('from your computer.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        fileName = askopenfilename(parent=root, title='Open Image:')
        if len(fileName) > 0:
            loadPic = image.load(fileName)
            done = True
    elif mb[0] == 1 and redoRect.collidepoint((mx, my)):
        tool = 'redo'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Redo: Undoes the last', True, (0, 0, 0))
        txtPic2 = tnmFont.render('undo change.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        if len(redo) > 0 and click:
            screen.blit(redo[-1], (250, 100))
            undo.append(redo.pop())
    elif mb[0] == 1 and omnomRect.collidepoint((mx, my)):
        tool = 'omnom stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (248, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('OmNom Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and rotoRect.collidepoint((mx, my)):
        tool = 'roto stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (368, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Roto Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and lickRect.collidepoint((mx, my)):
        tool = 'lick stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (488, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Lick Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and blueRect.collidepoint((mx, my)):
        tool = 'blue stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (608, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Blue Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and tossRect.collidepoint((mx, my)):
        tool = 'toss stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (728, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Toss Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and booRect.collidepoint((mx, my)):
        tool = 'boo stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (848, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Boo Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and musicplayRect.collidepoint((mx, my)):
        if music == 'pause':
            mixer.music.unpause()
        elif music == 'stop':
            mixer.music.play()
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Music: Play button', True, (0, 0, 0))
        txtPic2 = tnmFont.render('starts the music. Pause', True, (0, 0, 0))
        txtPic3 = tnmFont.render('button temporarily stops', True, (0, 0, 0))
        txtPic4 = tnmFont.render('the music. Stop button', True, (0, 0, 0))
        txtPic5 = tnmFont.render('stops the music.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and musicpauseRect.collidepoint((mx, my)):
        mixer.music.pause()
        music = 'pause'
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Music: Play button', True, (0, 0, 0))
        txtPic2 = tnmFont.render('starts the music. Pause', True, (0, 0, 0))
        txtPic3 = tnmFont.render('button temporarily stops', True, (0, 0, 0))
        txtPic4 = tnmFont.render('the music. Stop button', True, (0, 0, 0))
        txtPic5 = tnmFont.render('stops the music.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and musicstopRect.collidepoint((mx, my)):
        mixer.music.stop()
        music = 'stop'
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Music: Play button', True, (0, 0, 0))
        txtPic2 = tnmFont.render('starts the music. Pause', True, (0, 0, 0))
        txtPic3 = tnmFont.render('button temporarily stops', True, (0, 0, 0))
        txtPic4 = tnmFont.render('the music. Stop button', True, (0, 0, 0))
        txtPic5 = tnmFont.render('stops the music.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    if mb[0] == 1 and colourRect.collidepoint((mx, my)):
        drawColour = screen.get_at((mx, my))
    if mb[0] == 1 and canvas.collidepoint((mx, my)):
        screen.set_clip(canvas)
        if tool == 'pencil':
            draw.line(screen, drawColour, (oldmx, oldmy), (mx, my), drawSize)
        elif tool == 'eraser':
            dist = hypot(oldmx - mx, oldmy - my)
            dist = max(1, dist)
            for i in range(int(dist)):
                x = int(mx + i / dist * (oldmx - mx))
                y = int(my + i / dist * (oldmy - my))
                draw.circle(screen, (255, 255, 255), (x, y), drawSize)
        elif tool == 'brush':
            dist = hypot(oldmx - mx, oldmy - my)
            dist = max(1, dist)
            for i in range(int(dist)):
                x = int(mx + i / dist * (oldmx - mx))
                y = int(my + i / dist * (oldmy - my))
                draw.circle(screen, drawColour, (x, y), drawSize)
        elif tool == 'eyedropper':
            drawColour = screen.get_at((mx, my))
            tool = oldtool
        elif tool == 'unfilled ellipse':
            screen.blit(copy, (0, 0))
            sx, sy = min(mx, start1), min(my, start2)
            width = max(mx, start1) - sx
            length = max(my, start2) - sy
            if min(width, length) < drawSize * 2:
                draw.ellipse(screen, drawColour, (sx, sy, width, length))
            else:
                draw.ellipse(screen, drawColour, (sx, sy, width, length),
                    drawSize)
        elif tool == 'unfilled rectangle':
            screen.blit(copy, (0, 0))
            width = mx - start1
            length = my - start2
            rec = Rect(start1, start2, width, length)
            draw.rect(screen, drawColour, rec, drawSize)
            draw.rect(screen, drawColour, (start1 - drawSize / 2 + 1, 
                start2 - drawSize / 2 + 1, drawSize, drawSize))
            draw.rect(screen, drawColour, (start1 - drawSize / 2 + 1, 
                start2 + length - drawSize / 2, drawSize, drawSize))
            draw.rect(screen, drawColour, (start1 + width - drawSize / 2, 
                start2 - drawSize / 2 + 1, drawSize, drawSize))
            draw.rect(screen, drawColour, (start1 + width - drawSize / 2, 
                start2 + length - drawSize / 2, drawSize, drawSize))
        elif tool == 'spray paint':
            for i in range(6):
                randmx, randmy = randint(mx - drawSize, mx + drawSize
                    ), randint(my - drawSize, my + drawSize)
                if hypot(randmx - mx, randmy - my) < drawSize:
                    draw.circle(screen, drawColour, (randmx, randmy), 0)
        elif tool == 'filled ellipse':
            screen.blit(copy, (0, 0))
            sx, sy = min(mx, start1), min(my, start2)
            width = max(mx, start1) - sx
            length = max(my, start2) - sy
            ellipse = Rect(sx, sy, width, length)
            draw.ellipse(screen, drawColour, ellipse)
        elif tool == 'filled rectangle':
            screen.blit(copy, (0, 0))
            width = mx - start1
            length = my - start2
            rec = Rect(start1, start2, width, length)
            draw.rect(screen, drawColour, rec)
        elif tool == 'line':
            screen.blit(copy, (0, 0))
            draw.line(screen, drawColour, start, (mx, my), drawSize)
        elif tool == 'polygon':
            if polydrawn == True:
                polypoints = []
                polydrawn = False
            if (mx, my) in polypoints:
                pass
            else:
                polypoints.append((mx, my))
        elif tool == 'load':
            if done:
                screen.blit(copy, (0, 0))
                screen.blit(loadPic, (mx, my))
                done = False
        elif tool == 'omnom stamp':
            screen.blit(copy, (0, 0))
            screen.blit(omnomPic, (mx - 45, my - 50))
        elif tool == 'roto stamp':
            screen.blit(copy, (0, 0))
            screen.blit(rotoPic, (mx - 45, my - 50))
        elif tool == 'lick stamp':
            screen.blit(copy, (0, 0))
            screen.blit(lickPic, (mx - 45, my - 50))
        elif tool == 'blue stamp':
            screen.blit(copy, (0, 0))
            screen.blit(bluePic, (mx - 45, my - 50))
        elif tool == 'toss stamp':
            screen.blit(copy, (0, 0))
            screen.blit(tossPic, (mx - 45, my - 50))
        elif tool == 'boo stamp':
            screen.blit(copy, (0, 0))
            screen.blit(booPic, (mx - 45, my - 50))
        screen.set_clip(None)
    if mb[2] == 1 and canvas.collidepoint((mx, my)):
        screen.set_clip(canvas)
        if tool == 'polygon':
            draw.polygon(screen, drawColour, polypoints, drawSize)
            polydrawn = True
        screen.set_clip(None)
    oldmx, oldmy = mx, my
    if tool != 'eyedropper':
        oldtool = tool
    display.flip()
font.quit()
del tnmFont
quit()

<mask token>
font.init()
root = Tk()
root.withdraw()
screen = display.set_mode((1000, 750))
display.set_caption('Cut the Rope 2 Paint Program')
screen.fill((255, 255, 255))
logoPic = image.load('logo.png')
logoPic = transform.scale(logoPic, (266, 100))
screen.blit(logoPic, (0, 0))
canvas = Rect(250, 100, 700, 530)
draw.rect(screen, (255, 255, 255), canvas)
draw.rect(screen, (0, 0, 0), (249, 99, 702, 532), 1)
helpRect = Rect(800, 10, 150, 80)
draw.rect(screen, (255, 255, 255), helpRect)
draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
tnmFont = font.SysFont('Times New Roman', 15)
draw.rect(screen, (255, 255, 255), helpRect)
draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
txtPic1 = tnmFont.render('Pencil: Sketch with ease', True, (0, 0, 0))
txtPic2 = tnmFont.render('Use mouse scroll to', True, (0, 0, 0))
txtPic3 = tnmFont.render('change size.', True, (0, 0, 0))
screen.blit(txtPic1, helpRect)
screen.blit(txtPic2, (800, 25, 150, 80))
screen.blit(txtPic3, (800, 40, 150, 80))
init()
mixer.music.load('music1.mp3')
mixer.music.play()
musicplayRect = Rect(967, 6, 25, 25)
musicpauseRect = Rect(967, 38, 25, 25)
musicstopRect = Rect(967, 69, 25, 25)
draw.rect(screen, (0, 0, 0), musicplayRect)
draw.rect(screen, (0, 0, 0), musicpauseRect)
draw.rect(screen, (0, 0, 0), musicstopRect)
music = ''
tool = 'pencil'
pencilRect = Rect(25, 100, 50, 50)
eraserRect = Rect(100, 100, 50, 50)
brushRect = Rect(175, 100, 50, 50)
eyedropperRect = Rect(25, 160, 50, 50)
rectunRect = Rect(100, 160, 50, 50)
ellipseunRect = Rect(175, 160, 50, 50)
sprayRect = Rect(25, 220, 50, 50)
rectfillRect = Rect(100, 220, 50, 50)
ellipsefillRect = Rect(175, 220, 50, 50)
clearRect = Rect(25, 280, 50, 50)
lineRect = Rect(100, 280, 50, 50)
polyRect = Rect(175, 280, 50, 50)
undoRect = Rect(25, 340, 50, 50)
saveRect = Rect(100, 340, 50, 50)
loadRect = Rect(175, 340, 50, 50)
redoRect = Rect(25, 400, 50, 50)
draw.rect(screen, (0, 0, 0), pencilRect)
draw.rect(screen, (0, 0, 0), eraserRect)
draw.rect(screen, (0, 0, 0), brushRect)
draw.rect(screen, (0, 0, 0), eyedropperRect)
draw.rect(screen, (0, 0, 0), rectunRect)
draw.rect(screen, (0, 0, 0), ellipseunRect)
draw.rect(screen, (0, 0, 0), sprayRect)
draw.rect(screen, (0, 0, 0), rectfillRect)
draw.rect(screen, (0, 0, 0), ellipsefillRect)
draw.rect(screen, (0, 0, 0), clearRect)
draw.rect(screen, (0, 0, 0), lineRect)
draw.rect(screen, (0, 0, 0), polyRect)
draw.rect(screen, (0, 0, 0), undoRect)
draw.rect(screen, (0, 0, 0), loadRect)
draw.rect(screen, (0, 0, 0), saveRect)
draw.rect(screen, (0, 0, 0), redoRect)
backgroundPic = image.load('background.png')
backgroundPic = transform.scale(backgroundPic, (50, 50))
musicbackgroundPic = transform.scale(backgroundPic, (25, 25))
screen.blit(backgroundPic, (25, 100))
screen.blit(backgroundPic, (100, 100))
screen.blit(backgroundPic, (175, 100))
screen.blit(backgroundPic, (25, 160))
screen.blit(backgroundPic, (100, 160))
screen.blit(backgroundPic, (175, 160))
screen.blit(backgroundPic, (25, 220))
screen.blit(backgroundPic, (100, 220))
screen.blit(backgroundPic, (175, 220))
screen.blit(backgroundPic, (25, 280))
screen.blit(backgroundPic, (100, 280))
screen.blit(backgroundPic, (175, 280))
screen.blit(backgroundPic, (25, 340))
screen.blit(backgroundPic, (100, 340))
screen.blit(backgroundPic, (175, 340))
screen.blit(backgroundPic, (25, 400))
screen.blit(musicbackgroundPic, (967, 6))
screen.blit(musicbackgroundPic, (967, 38))
screen.blit(musicbackgroundPic, (967, 69))
pencilPic = image.load('pencil.png')
pencilPic = transform.scale(pencilPic, (43, 43))
screen.blit(pencilPic, (27, 102))
draw.rect(screen, (0, 0, 0), (23, 98, 52, 52), 2)
eraserPic = image.load('eraser.png')
eraserPic = transform.scale(eraserPic, (45, 45))
screen.blit(eraserPic, (102, 102))
brushPic = image.load('brush.png')
brushPic = transform.scale(brushPic, (45, 42))
screen.blit(brushPic, (177, 102))
eyedropperPic = image.load('eyedropper.png')
eyedropperPic = transform.scale(eyedropperPic, (42, 42))
screen.blit(eyedropperPic, (28, 163))
rectunPic = image.load('unfilledrect.png')
rectunPic = transform.scale(rectunPic, (38, 25))
screen.blit(rectunPic, (106, 172))
ellipseunPic = image.load('unfilledellipse.png')
ellipseunPic = transform.scale(ellipseunPic, (38, 25))
screen.blit(ellipseunPic, (181, 172))
sprayPic = image.load('spraypaint.png')
sprayPic = transform.scale(sprayPic, (45, 45))
screen.blit(sprayPic, (31, 221))
rectfillPic = image.load('filledrect.png')
rectfillPic = transform.scale(rectfillPic, (38, 25))
screen.blit(rectfillPic, (106, 232))
ellipsefillPic = image.load('filledellipse.png')
ellipsefillPic = transform.scale(ellipsefillPic, (38, 25))
screen.blit(ellipsefillPic, (181, 232))
clearPic = image.load('clear.png')
clearPic = transform.scale(clearPic, (45, 45))
screen.blit(clearPic, (26, 284))
linePic = image.load('line.png')
linePic = transform.scale(linePic, (42, 42))
screen.blit(linePic, (103, 282))
polyPic = image.load('polygon.png')
polyPic = transform.scale(polyPic, (43, 45))
screen.blit(polyPic, (178, 282))
undoPic = image.load('undo.png')
undoPic = transform.scale(undoPic, (45, 45))
screen.blit(undoPic, (28, 342))
savePic = image.load('save.png')
savePic = transform.scale(savePic, (40, 40))
screen.blit(savePic, (104, 344))
loadPic = image.load('load.png')
loadPic = transform.scale(loadPic, (42, 45))
screen.blit(loadPic, (178, 342))
redoPic = image.load('redo.png')
redoPic = transform.scale(redoPic, (45, 45))
screen.blit(redoPic, (28, 402))
playPic = image.load('play.png')
playPic = transform.scale(playPic, (23, 23))
screen.blit(playPic, (968, 7))
pausePic = image.load('pause.png')
pausePic = transform.scale(pausePic, (23, 23))
screen.blit(pausePic, (968, 39))
stopPic = image.load('stop.png')
stopPic = transform.scale(stopPic, (23, 23))
screen.blit(stopPic, (968, 70))
drawSize = 1
drawColour = 0, 0, 0
colourPic = image.load('Colour.png')
colourPic = transform.scale(colourPic, (200, 150))
colourRect = Rect(25, 480, 200, 150)
draw.rect(screen, (0, 0, 0), colourRect)
screen.blit(colourPic, (25, 480))
omnomPic = image.load('omnom.png')
rotoPic = image.load('roto.png')
lickPic = image.load('lick.png')
bluePic = image.load('blue.png')
tossPic = image.load('toss.png')
booPic = image.load('boo.png')
omnomPic = transform.scale(omnomPic, (100, 100))
omnomRect = Rect(250, 640, 100, 100)
rotoPic = transform.scale(rotoPic, (100, 100))
rotoRect = Rect(370, 640, 100, 100)
lickPic = transform.scale(lickPic, (100, 100))
lickRect = Rect(490, 640, 100, 100)
bluePic = transform.scale(bluePic, (100, 100))
blueRect = Rect(610, 640, 100, 100)
tossPic = transform.scale(tossPic, (100, 100))
tossRect = Rect(730, 640, 100, 100)
booPic = transform.scale(booPic, (100, 100))
booRect = Rect(850, 640, 100, 100)
draw.rect(screen, (255, 255, 255), omnomRect)
draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
screen.blit(omnomPic, (250, 640))
draw.rect(screen, (255, 255, 255), rotoRect)
draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
screen.blit(rotoPic, (370, 640))
draw.rect(screen, (255, 255, 255), lickRect)
draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
screen.blit(lickPic, (490, 640))
draw.rect(screen, (255, 255, 255), blueRect)
draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
screen.blit(bluePic, (610, 640))
draw.rect(screen, (255, 255, 255), tossRect)
draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
screen.blit(tossPic, (730, 640))
draw.rect(screen, (255, 255, 255), booRect)
draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
screen.blit(booPic, (850, 640))
selectRect = Rect(102, 645, 60, 60)
draw.rect(screen, (0, 0, 0), (101, 644, 62, 62))
positionRect = Rect(102, 726, 60, 15)
draw.rect(screen, (0, 0, 0), (101, 725, 62, 17), 1)
undo = []
redo = []
polypoints = []
polydrawn = False
done = False
click = False
design1 = image.load('design1.png')
design1 = transform.scale(design1, (79, 75))
screen.blit(design1, (718, 15))
running = True
while running:
    click = False
    for e in event.get():
        if e.type == QUIT:
            running = False
        if e.type == MOUSEBUTTONDOWN:
            click = True
            start = e.pos
            start1, start2 = e.pos
            copy = screen.copy()
            if e.button == 4:
                drawSize += 1
            if e.button == 5:
                drawSize -= 1
        if e.type == MOUSEBUTTONUP:
            if e.button == 1 and canvas.collidepoint(mx, my):
                undo.append(screen.subsurface(canvas).copy())
                redo = []
    mx, my = mouse.get_pos()
    mb = mouse.get_pressed()
    if drawSize <= 0:
        drawSize = 1
    if drawSize > 25:
        drawSize = 25
    if tool == 'pencil' and drawSize > 5:
        drawSize = 5
    if tool == 'polygon' and drawSize > 10:
        drawSize = 10
    if tool == 'unfilled ellipse' and drawSize > 3:
        drawSize = 3
    if tool == 'spray paint' and drawSize < 8:
        drawSize = 8
    draw.rect(screen, (255, 255, 255), selectRect)
    draw.circle(screen, drawColour, (132, 675), drawSize)
    mxlocation = str(mx)
    mylocation = str(my)
    draw.rect(screen, (255, 255, 255), positionRect)
    positionPic = tnmFont.render(mxlocation + ',' + mylocation, True, (0, 0, 0)
        )
    screen.blit(positionPic, (106, 726, 60, 15))
    if mb[0] == 1 and pencilRect.collidepoint((mx, my)):
        tool = 'pencil'
        draw.rect(screen, (0, 0, 0), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Pencil: Sketch with ease', True, (0, 0, 0))
        txtPic2 = tnmFont.render('Use mouse scroll to', True, (0, 0, 0))
        txtPic3 = tnmFont.render('change size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and eraserRect.collidepoint((mx, my)):
        tool = 'eraser'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Eraser: To erase', True, (0, 0, 0))
        txtPic2 = tnmFont.render('mistakes.Use scroll', True, (0, 0, 0))
        txtPic3 = tnmFont.render('button to change size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and brushRect.collidepoint((mx, my)):
        tool = 'brush'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Brush: Draws smooth', True, (0, 0, 0))
        txtPic2 = tnmFont.render('lines. Use mouse', True, (0, 0, 0))
        txtPic3 = tnmFont.render('scroll to change size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and eyedropperRect.collidepoint((mx, my)):
        tool = 'eyedropper'
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Eyedropper: Selects', True, (0, 0, 0))
        txtPic2 = tnmFont.render('colour on canvas.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
    elif mb[0] == 1 and rectunRect.collidepoint((mx, my)):
        tool = 'unfilled rectangle'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Unfilled Rectangle:', True, (0, 0, 0))
        txtPic2 = tnmFont.render('Drag to draw the', True, (0, 0, 0))
        txtPic3 = tnmFont.render('rectangle border. Use', True, (0, 0, 0))
        txtPic4 = tnmFont.render('mouse scroll to', True, (0, 0, 0))
        txtPic5 = tnmFont.render('change border size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and ellipseunRect.collidepoint((mx, my)):
        tool = 'unfilled ellipse'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Unfilled Ellipse:', True, (0, 0, 0))
        txtPic2 = tnmFont.render('Drag to draw the', True, (0, 0, 0))
        txtPic3 = tnmFont.render('ellipse border. Use', True, (0, 0, 0))
        txtPic4 = tnmFont.render('mouse scroll to', True, (0, 0, 0))
        txtPic5 = tnmFont.render('change border size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and sprayRect.collidepoint((mx, my)):
        tool = 'spray paint'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Spray Paint: Creates', True, (0, 0, 0))
        txtPic2 = tnmFont.render('an airbrush affect.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
    elif mb[0] == 1 and rectfillRect.collidepoint((mx, my)):
        tool = 'filled rectangle'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Filled Rectangle: Drag', True, (0, 0, 0))
        txtPic2 = tnmFont.render('to draw a filled', True, (0, 0, 0))
        txtPic3 = tnmFont.render('rectangle.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and ellipsefillRect.collidepoint((mx, my)):
        tool = 'filled ellipse'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Filled Ellipse: Drag', True, (0, 0, 0))
        txtPic2 = tnmFont.render('to draw a filled', True, (0, 0, 0))
        txtPic3 = tnmFont.render('ellipse.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and clearRect.collidepoint((mx, my)):
        tool = 'clear'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), canvas)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Clear: Clears the canvas.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
    elif mb[0] == 1 and lineRect.collidepoint((mx, my)):
        tool = 'line'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Line: Drag to draw', True, (0, 0, 0))
        txtPic2 = tnmFont.render('a line. Use mouse', True, (0, 0, 0))
        txtPic3 = tnmFont.render('scroll to change size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and polyRect.collidepoint((mx, my)):
        tool = 'polygon'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Polygon: Left click to', True, (0, 0, 0))
        txtPic2 = tnmFont.render('add a vertex. Right click', True, (0, 0, 0))
        txtPic3 = tnmFont.render('to draw the polygon.', True, (0, 0, 0))
        txtPic4 = tnmFont.render('Use mouse scroll to', True, (0, 0, 0))
        txtPic5 = tnmFont.render('change border size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and undoRect.collidepoint((mx, my)):
        tool = 'undo'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Undo: Erases last', True, (0, 0, 0))
        txtPic2 = tnmFont.render('change done.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        if len(undo) > 1 and click:
            redo.append(undo.pop())
            screen.blit(undo[-1], (250, 100))
    elif mb[0] == 1 and saveRect.collidepoint((mx, my)):
        tool = 'save'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Save: Save the canvas', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on your computer.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        fileName = asksaveasfilename(parent=root, title='Save the image as...')
        if len(fileName) > 0:
            if '.png' or '.jpg' or '.bmp' not in filename:
                fileName += '.png'
            image.save(screen.subsurface(canvas), fileName)
    elif mb[0] == 1 and loadRect.collidepoint((mx, my)):
        tool = 'load'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Load: Click on canvas', True, (0, 0, 0))
        txtPic2 = tnmFont.render('to load a picture', True, (0, 0, 0))
        txtPic3 = tnmFont.render('from your computer.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        fileName = askopenfilename(parent=root, title='Open Image:')
        if len(fileName) > 0:
            loadPic = image.load(fileName)
            done = True
    elif mb[0] == 1 and redoRect.collidepoint((mx, my)):
        tool = 'redo'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Redo: Undoes the last', True, (0, 0, 0))
        txtPic2 = tnmFont.render('undo change.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        if len(redo) > 0 and click:
            screen.blit(redo[-1], (250, 100))
            undo.append(redo.pop())
    elif mb[0] == 1 and omnomRect.collidepoint((mx, my)):
        tool = 'omnom stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (248, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('OmNom Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and rotoRect.collidepoint((mx, my)):
        tool = 'roto stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (368, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Roto Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and lickRect.collidepoint((mx, my)):
        tool = 'lick stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (488, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Lick Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and blueRect.collidepoint((mx, my)):
        tool = 'blue stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (608, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Blue Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and tossRect.collidepoint((mx, my)):
        tool = 'toss stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (728, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Toss Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and booRect.collidepoint((mx, my)):
        tool = 'boo stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (848, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Boo Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and musicplayRect.collidepoint((mx, my)):
        if music == 'pause':
            mixer.music.unpause()
        elif music == 'stop':
            mixer.music.play()
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Music: Play button', True, (0, 0, 0))
        txtPic2 = tnmFont.render('starts the music. Pause', True, (0, 0, 0))
        txtPic3 = tnmFont.render('button temporarily stops', True, (0, 0, 0))
        txtPic4 = tnmFont.render('the music. Stop button', True, (0, 0, 0))
        txtPic5 = tnmFont.render('stops the music.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and musicpauseRect.collidepoint((mx, my)):
        mixer.music.pause()
        music = 'pause'
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Music: Play button', True, (0, 0, 0))
        txtPic2 = tnmFont.render('starts the music. Pause', True, (0, 0, 0))
        txtPic3 = tnmFont.render('button temporarily stops', True, (0, 0, 0))
        txtPic4 = tnmFont.render('the music. Stop button', True, (0, 0, 0))
        txtPic5 = tnmFont.render('stops the music.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and musicstopRect.collidepoint((mx, my)):
        mixer.music.stop()
        music = 'stop'
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Music: Play button', True, (0, 0, 0))
        txtPic2 = tnmFont.render('starts the music. Pause', True, (0, 0, 0))
        txtPic3 = tnmFont.render('button temporarily stops', True, (0, 0, 0))
        txtPic4 = tnmFont.render('the music. Stop button', True, (0, 0, 0))
        txtPic5 = tnmFont.render('stops the music.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    if mb[0] == 1 and colourRect.collidepoint((mx, my)):
        drawColour = screen.get_at((mx, my))
    if mb[0] == 1 and canvas.collidepoint((mx, my)):
        screen.set_clip(canvas)
        if tool == 'pencil':
            draw.line(screen, drawColour, (oldmx, oldmy), (mx, my), drawSize)
        elif tool == 'eraser':
            dist = hypot(oldmx - mx, oldmy - my)
            dist = max(1, dist)
            for i in range(int(dist)):
                x = int(mx + i / dist * (oldmx - mx))
                y = int(my + i / dist * (oldmy - my))
                draw.circle(screen, (255, 255, 255), (x, y), drawSize)
        elif tool == 'brush':
            dist = hypot(oldmx - mx, oldmy - my)
            dist = max(1, dist)
            for i in range(int(dist)):
                x = int(mx + i / dist * (oldmx - mx))
                y = int(my + i / dist * (oldmy - my))
                draw.circle(screen, drawColour, (x, y), drawSize)
        elif tool == 'eyedropper':
            drawColour = screen.get_at((mx, my))
            tool = oldtool
        elif tool == 'unfilled ellipse':
            screen.blit(copy, (0, 0))
            sx, sy = min(mx, start1), min(my, start2)
            width = max(mx, start1) - sx
            length = max(my, start2) - sy
            if min(width, length) < drawSize * 2:
                draw.ellipse(screen, drawColour, (sx, sy, width, length))
            else:
                draw.ellipse(screen, drawColour, (sx, sy, width, length),
                    drawSize)
        elif tool == 'unfilled rectangle':
            screen.blit(copy, (0, 0))
            width = mx - start1
            length = my - start2
            rec = Rect(start1, start2, width, length)
            draw.rect(screen, drawColour, rec, drawSize)
            draw.rect(screen, drawColour, (start1 - drawSize / 2 + 1, 
                start2 - drawSize / 2 + 1, drawSize, drawSize))
            draw.rect(screen, drawColour, (start1 - drawSize / 2 + 1, 
                start2 + length - drawSize / 2, drawSize, drawSize))
            draw.rect(screen, drawColour, (start1 + width - drawSize / 2, 
                start2 - drawSize / 2 + 1, drawSize, drawSize))
            draw.rect(screen, drawColour, (start1 + width - drawSize / 2, 
                start2 + length - drawSize / 2, drawSize, drawSize))
        elif tool == 'spray paint':
            for i in range(6):
                randmx, randmy = randint(mx - drawSize, mx + drawSize
                    ), randint(my - drawSize, my + drawSize)
                if hypot(randmx - mx, randmy - my) < drawSize:
                    draw.circle(screen, drawColour, (randmx, randmy), 0)
        elif tool == 'filled ellipse':
            screen.blit(copy, (0, 0))
            sx, sy = min(mx, start1), min(my, start2)
            width = max(mx, start1) - sx
            length = max(my, start2) - sy
            ellipse = Rect(sx, sy, width, length)
            draw.ellipse(screen, drawColour, ellipse)
        elif tool == 'filled rectangle':
            screen.blit(copy, (0, 0))
            width = mx - start1
            length = my - start2
            rec = Rect(start1, start2, width, length)
            draw.rect(screen, drawColour, rec)
        elif tool == 'line':
            screen.blit(copy, (0, 0))
            draw.line(screen, drawColour, start, (mx, my), drawSize)
        elif tool == 'polygon':
            if polydrawn == True:
                polypoints = []
                polydrawn = False
            if (mx, my) in polypoints:
                pass
            else:
                polypoints.append((mx, my))
        elif tool == 'load':
            if done:
                screen.blit(copy, (0, 0))
                screen.blit(loadPic, (mx, my))
                done = False
        elif tool == 'omnom stamp':
            screen.blit(copy, (0, 0))
            screen.blit(omnomPic, (mx - 45, my - 50))
        elif tool == 'roto stamp':
            screen.blit(copy, (0, 0))
            screen.blit(rotoPic, (mx - 45, my - 50))
        elif tool == 'lick stamp':
            screen.blit(copy, (0, 0))
            screen.blit(lickPic, (mx - 45, my - 50))
        elif tool == 'blue stamp':
            screen.blit(copy, (0, 0))
            screen.blit(bluePic, (mx - 45, my - 50))
        elif tool == 'toss stamp':
            screen.blit(copy, (0, 0))
            screen.blit(tossPic, (mx - 45, my - 50))
        elif tool == 'boo stamp':
            screen.blit(copy, (0, 0))
            screen.blit(booPic, (mx - 45, my - 50))
        screen.set_clip(None)
    if mb[2] == 1 and canvas.collidepoint((mx, my)):
        screen.set_clip(canvas)
        if tool == 'polygon':
            draw.polygon(screen, drawColour, polypoints, drawSize)
            polydrawn = True
        screen.set_clip(None)
    oldmx, oldmy = mx, my
    if tool != 'eyedropper':
        oldtool = tool
    display.flip()
font.quit()
del tnmFont
quit()

from random import *
from tkinter import *
from tkinter.filedialog import askopenfilename
from tkinter.filedialog import asksaveasfilename
from pygame import *
from math import *
font.init()
root = Tk()
root.withdraw()
screen = display.set_mode((1000, 750))
display.set_caption('Cut the Rope 2 Paint Program')
screen.fill((255, 255, 255))
logoPic = image.load('logo.png')
logoPic = transform.scale(logoPic, (266, 100))
screen.blit(logoPic, (0, 0))
canvas = Rect(250, 100, 700, 530)
draw.rect(screen, (255, 255, 255), canvas)
draw.rect(screen, (0, 0, 0), (249, 99, 702, 532), 1)
helpRect = Rect(800, 10, 150, 80)
draw.rect(screen, (255, 255, 255), helpRect)
draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
tnmFont = font.SysFont('Times New Roman', 15)
draw.rect(screen, (255, 255, 255), helpRect)
draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
txtPic1 = tnmFont.render('Pencil: Sketch with ease', True, (0, 0, 0))
txtPic2 = tnmFont.render('Use mouse scroll to', True, (0, 0, 0))
txtPic3 = tnmFont.render('change size.', True, (0, 0, 0))
screen.blit(txtPic1, helpRect)
screen.blit(txtPic2, (800, 25, 150, 80))
screen.blit(txtPic3, (800, 40, 150, 80))
init()
mixer.music.load('music1.mp3')
mixer.music.play()
musicplayRect = Rect(967, 6, 25, 25)
musicpauseRect = Rect(967, 38, 25, 25)
musicstopRect = Rect(967, 69, 25, 25)
draw.rect(screen, (0, 0, 0), musicplayRect)
draw.rect(screen, (0, 0, 0), musicpauseRect)
draw.rect(screen, (0, 0, 0), musicstopRect)
music = ''
tool = 'pencil'
pencilRect = Rect(25, 100, 50, 50)
eraserRect = Rect(100, 100, 50, 50)
brushRect = Rect(175, 100, 50, 50)
eyedropperRect = Rect(25, 160, 50, 50)
rectunRect = Rect(100, 160, 50, 50)
ellipseunRect = Rect(175, 160, 50, 50)
sprayRect = Rect(25, 220, 50, 50)
rectfillRect = Rect(100, 220, 50, 50)
ellipsefillRect = Rect(175, 220, 50, 50)
clearRect = Rect(25, 280, 50, 50)
lineRect = Rect(100, 280, 50, 50)
polyRect = Rect(175, 280, 50, 50)
undoRect = Rect(25, 340, 50, 50)
saveRect = Rect(100, 340, 50, 50)
loadRect = Rect(175, 340, 50, 50)
redoRect = Rect(25, 400, 50, 50)
draw.rect(screen, (0, 0, 0), pencilRect)
draw.rect(screen, (0, 0, 0), eraserRect)
draw.rect(screen, (0, 0, 0), brushRect)
draw.rect(screen, (0, 0, 0), eyedropperRect)
draw.rect(screen, (0, 0, 0), rectunRect)
draw.rect(screen, (0, 0, 0), ellipseunRect)
draw.rect(screen, (0, 0, 0), sprayRect)
draw.rect(screen, (0, 0, 0), rectfillRect)
draw.rect(screen, (0, 0, 0), ellipsefillRect)
draw.rect(screen, (0, 0, 0), clearRect)
draw.rect(screen, (0, 0, 0), lineRect)
draw.rect(screen, (0, 0, 0), polyRect)
draw.rect(screen, (0, 0, 0), undoRect)
draw.rect(screen, (0, 0, 0), loadRect)
draw.rect(screen, (0, 0, 0), saveRect)
draw.rect(screen, (0, 0, 0), redoRect)
backgroundPic = image.load('background.png')
backgroundPic = transform.scale(backgroundPic, (50, 50))
musicbackgroundPic = transform.scale(backgroundPic, (25, 25))
screen.blit(backgroundPic, (25, 100))
screen.blit(backgroundPic, (100, 100))
screen.blit(backgroundPic, (175, 100))
screen.blit(backgroundPic, (25, 160))
screen.blit(backgroundPic, (100, 160))
screen.blit(backgroundPic, (175, 160))
screen.blit(backgroundPic, (25, 220))
screen.blit(backgroundPic, (100, 220))
screen.blit(backgroundPic, (175, 220))
screen.blit(backgroundPic, (25, 280))
screen.blit(backgroundPic, (100, 280))
screen.blit(backgroundPic, (175, 280))
screen.blit(backgroundPic, (25, 340))
screen.blit(backgroundPic, (100, 340))
screen.blit(backgroundPic, (175, 340))
screen.blit(backgroundPic, (25, 400))
screen.blit(musicbackgroundPic, (967, 6))
screen.blit(musicbackgroundPic, (967, 38))
screen.blit(musicbackgroundPic, (967, 69))
pencilPic = image.load('pencil.png')
pencilPic = transform.scale(pencilPic, (43, 43))
screen.blit(pencilPic, (27, 102))
draw.rect(screen, (0, 0, 0), (23, 98, 52, 52), 2)
eraserPic = image.load('eraser.png')
eraserPic = transform.scale(eraserPic, (45, 45))
screen.blit(eraserPic, (102, 102))
brushPic = image.load('brush.png')
brushPic = transform.scale(brushPic, (45, 42))
screen.blit(brushPic, (177, 102))
eyedropperPic = image.load('eyedropper.png')
eyedropperPic = transform.scale(eyedropperPic, (42, 42))
screen.blit(eyedropperPic, (28, 163))
rectunPic = image.load('unfilledrect.png')
rectunPic = transform.scale(rectunPic, (38, 25))
screen.blit(rectunPic, (106, 172))
ellipseunPic = image.load('unfilledellipse.png')
ellipseunPic = transform.scale(ellipseunPic, (38, 25))
screen.blit(ellipseunPic, (181, 172))
sprayPic = image.load('spraypaint.png')
sprayPic = transform.scale(sprayPic, (45, 45))
screen.blit(sprayPic, (31, 221))
rectfillPic = image.load('filledrect.png')
rectfillPic = transform.scale(rectfillPic, (38, 25))
screen.blit(rectfillPic, (106, 232))
ellipsefillPic = image.load('filledellipse.png')
ellipsefillPic = transform.scale(ellipsefillPic, (38, 25))
screen.blit(ellipsefillPic, (181, 232))
clearPic = image.load('clear.png')
clearPic = transform.scale(clearPic, (45, 45))
screen.blit(clearPic, (26, 284))
linePic = image.load('line.png')
linePic = transform.scale(linePic, (42, 42))
screen.blit(linePic, (103, 282))
polyPic = image.load('polygon.png')
polyPic = transform.scale(polyPic, (43, 45))
screen.blit(polyPic, (178, 282))
undoPic = image.load('undo.png')
undoPic = transform.scale(undoPic, (45, 45))
screen.blit(undoPic, (28, 342))
savePic = image.load('save.png')
savePic = transform.scale(savePic, (40, 40))
screen.blit(savePic, (104, 344))
loadPic = image.load('load.png')
loadPic = transform.scale(loadPic, (42, 45))
screen.blit(loadPic, (178, 342))
redoPic = image.load('redo.png')
redoPic = transform.scale(redoPic, (45, 45))
screen.blit(redoPic, (28, 402))
playPic = image.load('play.png')
playPic = transform.scale(playPic, (23, 23))
screen.blit(playPic, (968, 7))
pausePic = image.load('pause.png')
pausePic = transform.scale(pausePic, (23, 23))
screen.blit(pausePic, (968, 39))
stopPic = image.load('stop.png')
stopPic = transform.scale(stopPic, (23, 23))
screen.blit(stopPic, (968, 70))
drawSize = 1
drawColour = 0, 0, 0
colourPic = image.load('Colour.png')
colourPic = transform.scale(colourPic, (200, 150))
colourRect = Rect(25, 480, 200, 150)
draw.rect(screen, (0, 0, 0), colourRect)
screen.blit(colourPic, (25, 480))
omnomPic = image.load('omnom.png')
rotoPic = image.load('roto.png')
lickPic = image.load('lick.png')
bluePic = image.load('blue.png')
tossPic = image.load('toss.png')
booPic = image.load('boo.png')
omnomPic = transform.scale(omnomPic, (100, 100))
omnomRect = Rect(250, 640, 100, 100)
rotoPic = transform.scale(rotoPic, (100, 100))
rotoRect = Rect(370, 640, 100, 100)
lickPic = transform.scale(lickPic, (100, 100))
lickRect = Rect(490, 640, 100, 100)
bluePic = transform.scale(bluePic, (100, 100))
blueRect = Rect(610, 640, 100, 100)
tossPic = transform.scale(tossPic, (100, 100))
tossRect = Rect(730, 640, 100, 100)
booPic = transform.scale(booPic, (100, 100))
booRect = Rect(850, 640, 100, 100)
draw.rect(screen, (255, 255, 255), omnomRect)
draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
screen.blit(omnomPic, (250, 640))
draw.rect(screen, (255, 255, 255), rotoRect)
draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
screen.blit(rotoPic, (370, 640))
draw.rect(screen, (255, 255, 255), lickRect)
draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
screen.blit(lickPic, (490, 640))
draw.rect(screen, (255, 255, 255), blueRect)
draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
screen.blit(bluePic, (610, 640))
draw.rect(screen, (255, 255, 255), tossRect)
draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
screen.blit(tossPic, (730, 640))
draw.rect(screen, (255, 255, 255), booRect)
draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
screen.blit(booPic, (850, 640))
selectRect = Rect(102, 645, 60, 60)
draw.rect(screen, (0, 0, 0), (101, 644, 62, 62))
positionRect = Rect(102, 726, 60, 15)
draw.rect(screen, (0, 0, 0), (101, 725, 62, 17), 1)
undo = []
redo = []
polypoints = []
polydrawn = False
done = False
click = False
design1 = image.load('design1.png')
design1 = transform.scale(design1, (79, 75))
screen.blit(design1, (718, 15))
running = True
while running:
    click = False
    for e in event.get():
        if e.type == QUIT:
            running = False
        if e.type == MOUSEBUTTONDOWN:
            click = True
            start = e.pos
            start1, start2 = e.pos
            copy = screen.copy()
            if e.button == 4:
                drawSize += 1
            if e.button == 5:
                drawSize -= 1
        if e.type == MOUSEBUTTONUP:
            if e.button == 1 and canvas.collidepoint(mx, my):
                undo.append(screen.subsurface(canvas).copy())
                redo = []
    mx, my = mouse.get_pos()
    mb = mouse.get_pressed()
    if drawSize <= 0:
        drawSize = 1
    if drawSize > 25:
        drawSize = 25
    if tool == 'pencil' and drawSize > 5:
        drawSize = 5
    if tool == 'polygon' and drawSize > 10:
        drawSize = 10
    if tool == 'unfilled ellipse' and drawSize > 3:
        drawSize = 3
    if tool == 'spray paint' and drawSize < 8:
        drawSize = 8
    draw.rect(screen, (255, 255, 255), selectRect)
    draw.circle(screen, drawColour, (132, 675), drawSize)
    mxlocation = str(mx)
    mylocation = str(my)
    draw.rect(screen, (255, 255, 255), positionRect)
    positionPic = tnmFont.render(mxlocation + ',' + mylocation, True, (0, 0, 0)
        )
    screen.blit(positionPic, (106, 726, 60, 15))
    if mb[0] == 1 and pencilRect.collidepoint((mx, my)):
        tool = 'pencil'
        draw.rect(screen, (0, 0, 0), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Pencil: Sketch with ease', True, (0, 0, 0))
        txtPic2 = tnmFont.render('Use mouse scroll to', True, (0, 0, 0))
        txtPic3 = tnmFont.render('change size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and eraserRect.collidepoint((mx, my)):
        tool = 'eraser'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Eraser: To erase', True, (0, 0, 0))
        txtPic2 = tnmFont.render('mistakes.Use scroll', True, (0, 0, 0))
        txtPic3 = tnmFont.render('button to change size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and brushRect.collidepoint((mx, my)):
        tool = 'brush'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Brush: Draws smooth', True, (0, 0, 0))
        txtPic2 = tnmFont.render('lines. Use mouse', True, (0, 0, 0))
        txtPic3 = tnmFont.render('scroll to change size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and eyedropperRect.collidepoint((mx, my)):
        tool = 'eyedropper'
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Eyedropper: Selects', True, (0, 0, 0))
        txtPic2 = tnmFont.render('colour on canvas.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
    elif mb[0] == 1 and rectunRect.collidepoint((mx, my)):
        tool = 'unfilled rectangle'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Unfilled Rectangle:', True, (0, 0, 0))
        txtPic2 = tnmFont.render('Drag to draw the', True, (0, 0, 0))
        txtPic3 = tnmFont.render('rectangle border. Use', True, (0, 0, 0))
        txtPic4 = tnmFont.render('mouse scroll to', True, (0, 0, 0))
        txtPic5 = tnmFont.render('change border size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and ellipseunRect.collidepoint((mx, my)):
        tool = 'unfilled ellipse'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Unfilled Ellipse:', True, (0, 0, 0))
        txtPic2 = tnmFont.render('Drag to draw the', True, (0, 0, 0))
        txtPic3 = tnmFont.render('ellipse border. Use', True, (0, 0, 0))
        txtPic4 = tnmFont.render('mouse scroll to', True, (0, 0, 0))
        txtPic5 = tnmFont.render('change border size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and sprayRect.collidepoint((mx, my)):
        tool = 'spray paint'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Spray Paint: Creates', True, (0, 0, 0))
        txtPic2 = tnmFont.render('an airbrush affect.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
    elif mb[0] == 1 and rectfillRect.collidepoint((mx, my)):
        tool = 'filled rectangle'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Filled Rectangle: Drag', True, (0, 0, 0))
        txtPic2 = tnmFont.render('to draw a filled', True, (0, 0, 0))
        txtPic3 = tnmFont.render('rectangle.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and ellipsefillRect.collidepoint((mx, my)):
        tool = 'filled ellipse'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Filled Ellipse: Drag', True, (0, 0, 0))
        txtPic2 = tnmFont.render('to draw a filled', True, (0, 0, 0))
        txtPic3 = tnmFont.render('ellipse.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and clearRect.collidepoint((mx, my)):
        tool = 'clear'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), canvas)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Clear: Clears the canvas.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
    elif mb[0] == 1 and lineRect.collidepoint((mx, my)):
        tool = 'line'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Line: Drag to draw', True, (0, 0, 0))
        txtPic2 = tnmFont.render('a line. Use mouse', True, (0, 0, 0))
        txtPic3 = tnmFont.render('scroll to change size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and polyRect.collidepoint((mx, my)):
        tool = 'polygon'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Polygon: Left click to', True, (0, 0, 0))
        txtPic2 = tnmFont.render('add a vertex. Right click', True, (0, 0, 0))
        txtPic3 = tnmFont.render('to draw the polygon.', True, (0, 0, 0))
        txtPic4 = tnmFont.render('Use mouse scroll to', True, (0, 0, 0))
        txtPic5 = tnmFont.render('change border size.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and undoRect.collidepoint((mx, my)):
        tool = 'undo'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Undo: Erases last', True, (0, 0, 0))
        txtPic2 = tnmFont.render('change done.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        if len(undo) > 1 and click:
            redo.append(undo.pop())
            screen.blit(undo[-1], (250, 100))
    elif mb[0] == 1 and saveRect.collidepoint((mx, my)):
        tool = 'save'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Save: Save the canvas', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on your computer.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        fileName = asksaveasfilename(parent=root, title='Save the image as...')
        if len(fileName) > 0:
            if '.png' or '.jpg' or '.bmp' not in filename:
                fileName += '.png'
            image.save(screen.subsurface(canvas), fileName)
    elif mb[0] == 1 and loadRect.collidepoint((mx, my)):
        tool = 'load'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Load: Click on canvas', True, (0, 0, 0))
        txtPic2 = tnmFont.render('to load a picture', True, (0, 0, 0))
        txtPic3 = tnmFont.render('from your computer.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        fileName = askopenfilename(parent=root, title='Open Image:')
        if len(fileName) > 0:
            loadPic = image.load(fileName)
            done = True
    elif mb[0] == 1 and redoRect.collidepoint((mx, my)):
        tool = 'redo'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Redo: Undoes the last', True, (0, 0, 0))
        txtPic2 = tnmFont.render('undo change.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        if len(redo) > 0 and click:
            screen.blit(redo[-1], (250, 100))
            undo.append(redo.pop())
    elif mb[0] == 1 and omnomRect.collidepoint((mx, my)):
        tool = 'omnom stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (0, 0, 0), (248, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('OmNom Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and rotoRect.collidepoint((mx, my)):
        tool = 'roto stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (368, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Roto Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and lickRect.collidepoint((mx, my)):
        tool = 'lick stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (488, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Lick Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and blueRect.collidepoint((mx, my)):
        tool = 'blue stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (608, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Blue Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and tossRect.collidepoint((mx, my)):
        tool = 'toss stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (728, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), (848, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (849, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Toss Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and booRect.collidepoint((mx, my)):
        tool = 'boo stamp'
        draw.rect(screen, (255, 255, 255), (23, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 98, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 158, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 218, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 278, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (98, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (173, 338, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (23, 398, 52, 52), 2)
        draw.rect(screen, (255, 255, 255), (248, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (249, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (368, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (369, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (488, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (489, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (608, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (609, 639, 102, 102), 1)
        draw.rect(screen, (255, 255, 255), (728, 638, 102, 102), 2)
        draw.rect(screen, (0, 0, 0), (729, 639, 102, 102), 1)
        draw.rect(screen, (0, 0, 0), (848, 638, 102, 102), 2)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Boo Stamp: Click', True, (0, 0, 0))
        txtPic2 = tnmFont.render('on canvas to stamp', True, (0, 0, 0))
        txtPic3 = tnmFont.render('image.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
    elif mb[0] == 1 and musicplayRect.collidepoint((mx, my)):
        if music == 'pause':
            mixer.music.unpause()
        elif music == 'stop':
            mixer.music.play()
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Music: Play button', True, (0, 0, 0))
        txtPic2 = tnmFont.render('starts the music. Pause', True, (0, 0, 0))
        txtPic3 = tnmFont.render('button temporarily stops', True, (0, 0, 0))
        txtPic4 = tnmFont.render('the music. Stop button', True, (0, 0, 0))
        txtPic5 = tnmFont.render('stops the music.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and musicpauseRect.collidepoint((mx, my)):
        mixer.music.pause()
        music = 'pause'
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Music: Play button', True, (0, 0, 0))
        txtPic2 = tnmFont.render('starts the music. Pause', True, (0, 0, 0))
        txtPic3 = tnmFont.render('button temporarily stops', True, (0, 0, 0))
        txtPic4 = tnmFont.render('the music. Stop button', True, (0, 0, 0))
        txtPic5 = tnmFont.render('stops the music.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    elif mb[0] == 1 and musicstopRect.collidepoint((mx, my)):
        mixer.music.stop()
        music = 'stop'
        draw.rect(screen, (255, 255, 255), helpRect)
        draw.rect(screen, (0, 0, 0), (799, 9, 152, 82), 1)
        txtPic1 = tnmFont.render('Music: Play button', True, (0, 0, 0))
        txtPic2 = tnmFont.render('starts the music. Pause', True, (0, 0, 0))
        txtPic3 = tnmFont.render('button temporarily stops', True, (0, 0, 0))
        txtPic4 = tnmFont.render('the music. Stop button', True, (0, 0, 0))
        txtPic5 = tnmFont.render('stops the music.', True, (0, 0, 0))
        screen.blit(txtPic1, helpRect)
        screen.blit(txtPic2, (800, 25, 150, 80))
        screen.blit(txtPic3, (800, 40, 150, 80))
        screen.blit(txtPic4, (800, 55, 150, 80))
        screen.blit(txtPic5, (800, 70, 150, 80))
    if mb[0] == 1 and colourRect.collidepoint((mx, my)):
        drawColour = screen.get_at((mx, my))
    if mb[0] == 1 and canvas.collidepoint((mx, my)):
        screen.set_clip(canvas)
        if tool == 'pencil':
            draw.line(screen, drawColour, (oldmx, oldmy), (mx, my), drawSize)
        elif tool == 'eraser':
            dist = hypot(oldmx - mx, oldmy - my)
            dist = max(1, dist)
            for i in range(int(dist)):
                x = int(mx + i / dist * (oldmx - mx))
                y = int(my + i / dist * (oldmy - my))
                draw.circle(screen, (255, 255, 255), (x, y), drawSize)
        elif tool == 'brush':
            dist = hypot(oldmx - mx, oldmy - my)
            dist = max(1, dist)
            for i in range(int(dist)):
                x = int(mx + i / dist * (oldmx - mx))
                y = int(my + i / dist * (oldmy - my))
                draw.circle(screen, drawColour, (x, y), drawSize)
        elif tool == 'eyedropper':
            drawColour = screen.get_at((mx, my))
            tool = oldtool
        elif tool == 'unfilled ellipse':
            screen.blit(copy, (0, 0))
            sx, sy = min(mx, start1), min(my, start2)
            width = max(mx, start1) - sx
            length = max(my, start2) - sy
            if min(width, length) < drawSize * 2:
                draw.ellipse(screen, drawColour, (sx, sy, width, length))
            else:
                draw.ellipse(screen, drawColour, (sx, sy, width, length),
                    drawSize)
        elif tool == 'unfilled rectangle':
            screen.blit(copy, (0, 0))
            width = mx - start1
            length = my - start2
            rec = Rect(start1, start2, width, length)
            draw.rect(screen, drawColour, rec, drawSize)
            draw.rect(screen, drawColour, (start1 - drawSize / 2 + 1, 
                start2 - drawSize / 2 + 1, drawSize, drawSize))
            draw.rect(screen, drawColour, (start1 - drawSize / 2 + 1, 
                start2 + length - drawSize / 2, drawSize, drawSize))
            draw.rect(screen, drawColour, (start1 + width - drawSize / 2, 
                start2 - drawSize / 2 + 1, drawSize, drawSize))
            draw.rect(screen, drawColour, (start1 + width - drawSize / 2, 
                start2 + length - drawSize / 2, drawSize, drawSize))
        elif tool == 'spray paint':
            for i in range(6):
                randmx, randmy = randint(mx - drawSize, mx + drawSize
                    ), randint(my - drawSize, my + drawSize)
                if hypot(randmx - mx, randmy - my) < drawSize:
                    draw.circle(screen, drawColour, (randmx, randmy), 0)
        elif tool == 'filled ellipse':
            screen.blit(copy, (0, 0))
            sx, sy = min(mx, start1), min(my, start2)
            width = max(mx, start1) - sx
            length = max(my, start2) - sy
            ellipse = Rect(sx, sy, width, length)
            draw.ellipse(screen, drawColour, ellipse)
        elif tool == 'filled rectangle':
            screen.blit(copy, (0, 0))
            width = mx - start1
            length = my - start2
            rec = Rect(start1, start2, width, length)
            draw.rect(screen, drawColour, rec)
        elif tool == 'line':
            screen.blit(copy, (0, 0))
            draw.line(screen, drawColour, start, (mx, my), drawSize)
        elif tool == 'polygon':
            if polydrawn == True:
                polypoints = []
                polydrawn = False
            if (mx, my) in polypoints:
                pass
            else:
                polypoints.append((mx, my))
        elif tool == 'load':
            if done:
                screen.blit(copy, (0, 0))
                screen.blit(loadPic, (mx, my))
                done = False
        elif tool == 'omnom stamp':
            screen.blit(copy, (0, 0))
            screen.blit(omnomPic, (mx - 45, my - 50))
        elif tool == 'roto stamp':
            screen.blit(copy, (0, 0))
            screen.blit(rotoPic, (mx - 45, my - 50))
        elif tool == 'lick stamp':
            screen.blit(copy, (0, 0))
            screen.blit(lickPic, (mx - 45, my - 50))
        elif tool == 'blue stamp':
            screen.blit(copy, (0, 0))
            screen.blit(bluePic, (mx - 45, my - 50))
        elif tool == 'toss stamp':
            screen.blit(copy, (0, 0))
            screen.blit(tossPic, (mx - 45, my - 50))
        elif tool == 'boo stamp':
            screen.blit(copy, (0, 0))
            screen.blit(booPic, (mx - 45, my - 50))
        screen.set_clip(None)
    if mb[2] == 1 and canvas.collidepoint((mx, my)):
        screen.set_clip(canvas)
        if tool == 'polygon':
            draw.polygon(screen, drawColour, polypoints, drawSize)
            polydrawn = True
        screen.set_clip(None)
    oldmx, oldmy = mx, my
    if tool != 'eyedropper':
        oldtool = tool
    display.flip()
font.quit()
del tnmFont
quit()

#paintprogram.py
#Lucille Xiong
from random import *
from tkinter import *
from tkinter.filedialog import askopenfilename
from tkinter.filedialog import asksaveasfilename
from pygame import *
from math import *
font.init()
root=Tk() 
root.withdraw()
screen=display.set_mode((1000,750))
display.set_caption("Cut the Rope 2 Paint Program")
screen.fill((255,255,255))
#logo
logoPic=image.load("logo.png")
logoPic=transform.scale(logoPic,(266,100))
screen.blit(logoPic,(0,0))
#canvas
canvas=Rect(250,100,700,530)
draw.rect(screen,(255,255,255),canvas)
draw.rect(screen,(0,0,0),(249,99,702,532),1) #outlines the canvas
#help box
helpRect=Rect(800,10,150,80)
draw.rect(screen,(255,255,255),helpRect)
draw.rect(screen,(0,0,0),(799,9,152,82),1)#draw black outline around the helpRect
#font
tnmFont=font.SysFont("Times New Roman",15)
#starting help box
draw.rect(screen,(255,255,255),helpRect)
draw.rect(screen,(0,0,0),(799,9,152,82),1)
txtPic1=tnmFont.render("Pencil: Sketch with ease",True,(0,0,0))
txtPic2=tnmFont.render("Use mouse scroll to",True,(0,0,0))
txtPic3=tnmFont.render("change size.",True,(0,0,0))
screen.blit(txtPic1,(helpRect))
screen.blit(txtPic2,(800,25,150,80))
screen.blit(txtPic3,(800,40,150,80))
#music
init()
mixer.music.load("music1.mp3")
mixer.music.play()
musicplayRect=Rect(967,6,25,25)
musicpauseRect=Rect(967,38,25,25)
musicstopRect=Rect(967,69,25,25)
draw.rect(screen,(0,0,0),musicplayRect)
draw.rect(screen,(0,0,0),musicpauseRect)
draw.rect(screen,(0,0,0),musicstopRect)
music="" #decides whether the music should reload or unpause
#tools
tool="pencil"
pencilRect=Rect(25,100,50,50)
eraserRect=Rect(100,100,50,50)
brushRect=Rect(175,100,50,50)
eyedropperRect=Rect(25,160,50,50)
rectunRect=Rect(100,160,50,50) #unfilled rectangle
ellipseunRect=Rect(175,160,50,50) #unfilled ellipse
sprayRect=Rect(25,220,50,50)
rectfillRect=Rect(100,220,50,50) #filled rectangle
ellipsefillRect=Rect(175,220,50,50) #filled ellipse
clearRect=Rect(25,280,50,50)
lineRect=Rect(100,280,50,50)
polyRect=Rect(175,280,50,50)
undoRect=Rect(25,340,50,50)
saveRect=Rect(100,340,50,50)
loadRect=Rect(175,340,50,50)
redoRect=Rect(25,400,50,50)
#draws the tool's rect
draw.rect(screen,(0,0,0),pencilRect)
draw.rect(screen,(0,0,0),eraserRect)
draw.rect(screen,(0,0,0),brushRect)
draw.rect(screen,(0,0,0),eyedropperRect)
draw.rect(screen,(0,0,0),rectunRect)
draw.rect(screen,(0,0,0),ellipseunRect)
draw.rect(screen,(0,0,0),sprayRect)
draw.rect(screen,(0,0,0),rectfillRect)
draw.rect(screen,(0,0,0),ellipsefillRect)
draw.rect(screen,(0,0,0),clearRect)
draw.rect(screen,(0,0,0),lineRect)
draw.rect(screen,(0,0,0),polyRect)
draw.rect(screen,(0,0,0),undoRect)
draw.rect(screen,(0,0,0),loadRect)
draw.rect(screen,(0,0,0),saveRect)
draw.rect(screen,(0,0,0),redoRect)
#tools' picture
backgroundPic=image.load("background.png") #the green background of all the tools
backgroundPic=transform.scale(backgroundPic,(50,50))
musicbackgroundPic=transform.scale(backgroundPic,(25,25)) #use for the music buttons
screen.blit(backgroundPic,(25,100))
screen.blit(backgroundPic,(100,100))
screen.blit(backgroundPic,(175,100))
screen.blit(backgroundPic,(25,160))
screen.blit(backgroundPic,(100,160))
screen.blit(backgroundPic,(175,160))
screen.blit(backgroundPic,(25,220))
screen.blit(backgroundPic,(100,220))
screen.blit(backgroundPic,(175,220))
screen.blit(backgroundPic,(25,280))
screen.blit(backgroundPic,(100,280))
screen.blit(backgroundPic,(175,280))
screen.blit(backgroundPic,(25,340))
screen.blit(backgroundPic,(100,340))
screen.blit(backgroundPic,(175,340))
screen.blit(backgroundPic,(25,400))
screen.blit(musicbackgroundPic,(967,6))
screen.blit(musicbackgroundPic,(967,38))
screen.blit(musicbackgroundPic,(967,69))
#tools pictures
pencilPic=image.load("pencil.png")
pencilPic=transform.scale(pencilPic,(43,43))
screen.blit(pencilPic,(27,102))
draw.rect(screen,(0,0,0),(23,98,52,52),2) #shows the beginning selected tool
eraserPic=image.load("eraser.png")
eraserPic=transform.scale(eraserPic,(45,45))
screen.blit(eraserPic,(102,102))
brushPic=image.load("brush.png")
brushPic=transform.scale(brushPic,(45,42))
screen.blit(brushPic,(177,102))
eyedropperPic=image.load("eyedropper.png")
eyedropperPic=transform.scale(eyedropperPic,(42,42))
screen.blit(eyedropperPic,(28,163))
rectunPic=image.load("unfilledrect.png")
rectunPic=transform.scale(rectunPic,(38,25))
screen.blit(rectunPic,(106,172))
ellipseunPic=image.load("unfilledellipse.png")
ellipseunPic=transform.scale(ellipseunPic,(38,25))
screen.blit(ellipseunPic,(181,172))
sprayPic=image.load("spraypaint.png")
sprayPic=transform.scale(sprayPic,(45,45))
screen.blit(sprayPic,(31,221))
rectfillPic=image.load("filledrect.png")
rectfillPic=transform.scale(rectfillPic,(38,25))
screen.blit(rectfillPic,(106,232))
ellipsefillPic=image.load("filledellipse.png")
ellipsefillPic=transform.scale(ellipsefillPic,(38,25))
screen.blit(ellipsefillPic,(181,232))
clearPic=image.load("clear.png")
clearPic=transform.scale(clearPic,(45,45))
screen.blit(clearPic,(26,284))
linePic=image.load("line.png")
linePic=transform.scale(linePic,(42,42))
screen.blit(linePic,(103,282))
polyPic=image.load("polygon.png")
polyPic=transform.scale(polyPic,(43,45))
screen.blit(polyPic,(178,282))
undoPic=image.load("undo.png")
undoPic=transform.scale(undoPic,(45,45))
screen.blit(undoPic,(28,342))
savePic=image.load("save.png")
savePic=transform.scale(savePic,(40,40))
screen.blit(savePic,(104,344))
loadPic=image.load("load.png")
loadPic=transform.scale(loadPic,(42,45))
screen.blit(loadPic,(178,342))
redoPic=image.load("redo.png")
redoPic=transform.scale(redoPic,(45,45))
screen.blit(redoPic,(28,402))
playPic=image.load("play.png")
playPic=transform.scale(playPic,(23,23))
screen.blit(playPic,(968,7))
pausePic=image.load("pause.png")
pausePic=transform.scale(pausePic,(23,23))
screen.blit(pausePic,(968,39))
stopPic=image.load("stop.png")
stopPic=transform.scale(stopPic,(23,23))
screen.blit(stopPic,(968,70))
#size
drawSize=1
#colour
drawColour=(0,0,0)
colourPic=image.load("Colour.png")
colourPic=transform.scale(colourPic,(200,150))
colourRect=Rect(25,480,200,150)
draw.rect(screen,(0,0,0),colourRect)
screen.blit(colourPic,(25,480))
#stamps
#loading and resizing stamps
omnomPic=image.load("omnom.png")
rotoPic=image.load("roto.png")
lickPic=image.load("lick.png")
bluePic=image.load("blue.png")
tossPic=image.load("toss.png")
booPic=image.load("boo.png")
omnomPic=transform.scale(omnomPic,(100,100))
omnomRect=Rect(250,640,100,100)
rotoPic=transform.scale(rotoPic,(100,100))
rotoRect=Rect(370,640,100,100)
lickPic=transform.scale(lickPic,(100,100))
lickRect=Rect(490,640,100,100)
bluePic=transform.scale(bluePic,(100,100))
blueRect=Rect(610,640,100,100)
tossPic=transform.scale(tossPic,(100,100))
tossRect=Rect(730,640,100,100)
booPic=transform.scale(booPic,(100,100))
booRect=Rect(850,640,100,100)
#blits the stamps
draw.rect(screen,(255,255,255),omnomRect)
draw.rect(screen,(0,0,0),(249,639,102,102),1) #outlines the Rect
screen.blit(omnomPic,(250,640))
draw.rect(screen,(255,255,255),rotoRect)
draw.rect(screen,(0,0,0),(369,639,102,102),1)
screen.blit(rotoPic,(370,640))
draw.rect(screen,(255,255,255),lickRect)
draw.rect(screen,(0,0,0),(489,639,102,102),1)
screen.blit(lickPic,(490,640))
draw.rect(screen,(255,255,255),blueRect)
draw.rect(screen,(0,0,0),(609,639,102,102),1)
screen.blit(bluePic,(610,640))
draw.rect(screen,(255,255,255),tossRect)
draw.rect(screen,(0,0,0),(729,639,102,102),1)
screen.blit(tossPic,(730,640))
draw.rect(screen,(255,255,255),booRect)
draw.rect(screen,(0,0,0),(849,639,102,102),1)
screen.blit(booPic,(850,640))
#selected size/colour
selectRect=Rect(102,645,60,60)
draw.rect(screen,(0,0,0),(101,644,62,62)) #outlines the rect
#mouse position rect
positionRect=Rect(102,726,60,15)
draw.rect(screen,(0,0,0),(101,725,62,17),1)
#undo/redo
undo=[]
redo=[]
#polygon tool
polypoints=[]
polydrawn=False
done=False #used for loading pictures from computer
click=False #used for undo and redo
#design
design1=image.load("design1.png")
design1=transform.scale(design1,(79,75))
screen.blit(design1,(718,15))
#paint word

running=True
while running:
    click=False
    for e in event.get():
        if e.type==QUIT:
            running=False
        if e.type==MOUSEBUTTONDOWN:
            click=True
            start=e.pos #usedin line tool
            start1,start2=e.pos #used in shapes
            copy=screen.copy()
            if e.button==4: #size of the tool
               drawSize+=1  #affects pencil, eraser, brush, spray paint, unfilled rect, unfiled ellipse, polygon
            if e.button==5:
               drawSize-=1
        if e.type==MOUSEBUTTONUP:
            if e.button==1 and canvas.collidepoint(mx,my):
                undo.append(screen.subsurface(canvas).copy())
                redo=[]
    mx,my=mouse.get_pos()
    mb=mouse.get_pressed()
    #limits the size of all the tools
    if drawSize<=0:
        drawSize=1
    if drawSize>25:
        drawSize=25
    #limits the size of specific tools
    if tool=="pencil" and drawSize>5:
        drawSize=5
    if tool=="polygon" and drawSize>10:
        drawSize=10
    if tool=="unfilled ellipse" and drawSize>3:
        drawSize=3
    if tool=="spray paint" and drawSize<8:
        drawSize=8
    #draws selcted size/colour
    draw.rect(screen,(255,255,255),selectRect)
    draw.circle(screen,drawColour,(132,675),drawSize)
    #mouse position
    mxlocation=str(mx)
    mylocation=str(my)
    draw.rect(screen,(255,255,255),positionRect)
    positionPic=tnmFont.render((mxlocation+","+mylocation),True,(0,0,0))
    screen.blit(positionPic,(106,726,60,15))
    #Remembers selected tool
    if mb[0]==1 and pencilRect.collidepoint((mx,my)):
        tool="pencil"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(0,0,0),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Pencil: Sketch with ease",True,(0,0,0))
        txtPic2=tnmFont.render("Use mouse scroll to",True,(0,0,0))
        txtPic3=tnmFont.render("change size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and eraserRect.collidepoint((mx,my)):
        tool="eraser"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(0,0,0),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Eraser: To erase",True,(0,0,0))
        txtPic2=tnmFont.render("mistakes.Use scroll",True,(0,0,0))
        txtPic3=tnmFont.render("button to change size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and brushRect.collidepoint((mx,my)):
        tool="brush"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(0,0,0),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Brush: Draws smooth",True,(0,0,0))
        txtPic2=tnmFont.render("lines. Use mouse",True,(0,0,0))
        txtPic3=tnmFont.render("scroll to change size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and eyedropperRect.collidepoint((mx,my)):
        tool="eyedropper"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(0,0,0),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Eyedropper: Selects",True,(0,0,0))
        txtPic2=tnmFont.render("colour on canvas.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
    elif mb[0]==1 and rectunRect.collidepoint((mx,my)):
        tool="unfilled rectangle"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(0,0,0),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Unfilled Rectangle:",True,(0,0,0))
        txtPic2=tnmFont.render("Drag to draw the",True,(0,0,0))
        txtPic3=tnmFont.render("rectangle border. Use",True,(0,0,0))
        txtPic4=tnmFont.render("mouse scroll to",True,(0,0,0))
        txtPic5=tnmFont.render("change border size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        screen.blit(txtPic4,(800,55,150,80))
        screen.blit(txtPic5,(800,70,150,80))
    elif mb[0]==1 and ellipseunRect.collidepoint((mx,my)):
        tool="unfilled ellipse"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(0,0,0),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Unfilled Ellipse:",True,(0,0,0))
        txtPic2=tnmFont.render("Drag to draw the",True,(0,0,0))
        txtPic3=tnmFont.render("ellipse border. Use",True,(0,0,0))
        txtPic4=tnmFont.render("mouse scroll to",True,(0,0,0))
        txtPic5=tnmFont.render("change border size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        screen.blit(txtPic4,(800,55,150,80))
        screen.blit(txtPic5,(800,70,150,80))
    elif mb[0]==1 and sprayRect.collidepoint((mx,my)):
        tool="spray paint"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(0,0,0),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box 
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Spray Paint: Creates",True,(0,0,0))
        txtPic2=tnmFont.render("an airbrush affect.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
    elif mb[0]==1 and rectfillRect.collidepoint((mx,my)):
        tool="filled rectangle"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(0,0,0),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Filled Rectangle: Drag",True,(0,0,0))
        txtPic2=tnmFont.render("to draw a filled",True,(0,0,0))
        txtPic3=tnmFont.render("rectangle.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and ellipsefillRect.collidepoint((mx,my)):
        tool="filled ellipse"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(0,0,0),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Filled Ellipse: Drag",True,(0,0,0))
        txtPic2=tnmFont.render("to draw a filled",True,(0,0,0))
        txtPic3=tnmFont.render("ellipse.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and clearRect.collidepoint((mx,my)):
        tool="clear"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(0,0,0),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        draw.rect(screen,(255,255,255),canvas)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Clear: Clears the canvas.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
    elif mb[0]==1 and lineRect.collidepoint((mx,my)):
        tool="line"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(0,0,0),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Line: Drag to draw",True,(0,0,0))
        txtPic2=tnmFont.render("a line. Use mouse",True,(0,0,0))
        txtPic3=tnmFont.render("scroll to change size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and polyRect.collidepoint((mx,my)):
        tool="polygon"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(0,0,0),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Polygon: Left click to",True,(0,0,0))
        txtPic2=tnmFont.render("add a vertex. Right click",True,(0,0,0))
        txtPic3=tnmFont.render("to draw the polygon.",True,(0,0,0))
        txtPic4=tnmFont.render("Use mouse scroll to",True,(0,0,0))
        txtPic5=tnmFont.render("change border size.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        screen.blit(txtPic4,(800,55,150,80))
        screen.blit(txtPic5,(800,70,150,80))
    elif mb[0]==1 and undoRect.collidepoint((mx,my)):
        tool="undo"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(0,0,0),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Undo: Erases last",True,(0,0,0))
        txtPic2=tnmFont.render("change done.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        if len(undo)>1 and click:
            redo.append(undo.pop())
            screen.blit(undo[-1],(250,100))
    elif mb[0]==1 and saveRect.collidepoint((mx,my)):
        tool="save"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(0,0,0),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Save: Save the canvas",True,(0,0,0))
        txtPic2=tnmFont.render("on your computer.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        fileName=asksaveasfilename(parent=root,title="Save the image as...")
        if len(fileName)>0:
            if ".png" or ".jpg" or ".bmp" not in filename: #if image type is specified add .png 
                fileName+=".png"
            image.save(screen.subsurface(canvas),fileName)
    elif mb[0]==1 and loadRect.collidepoint((mx,my)):
        tool="load"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(0,0,0),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Load: Click on canvas",True,(0,0,0))
        txtPic2=tnmFont.render("to load a picture",True,(0,0,0))
        txtPic3=tnmFont.render("from your computer.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        fileName=askopenfilename(parent=root,title="Open Image:")
        if len(fileName)>0:
            loadPic=image.load(fileName)
            done=True
    elif mb[0]==1 and redoRect.collidepoint((mx,my)):
        tool="redo"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(98,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(0,0,0),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Redo: Undoes the last",True,(0,0,0))
        txtPic2=tnmFont.render("undo change.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        if len(redo)>0 and click:
            screen.blit(redo[-1],(250,100))
            undo.append(redo.pop())
    elif mb[0]==1 and omnomRect.collidepoint((mx,my)):
        tool="omnom stamp"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(0,0,0),(248,638,102,102),2)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("OmNom Stamp: Click",True,(0,0,0))
        txtPic2=tnmFont.render("on canvas to stamp",True,(0,0,0))
        txtPic3=tnmFont.render("image.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and rotoRect.collidepoint((mx,my)):
        tool="roto stamp"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(0,0,0),(368,638,102,102),2)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Roto Stamp: Click",True,(0,0,0))
        txtPic2=tnmFont.render("on canvas to stamp",True,(0,0,0))
        txtPic3=tnmFont.render("image.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and lickRect.collidepoint((mx,my)):
        tool="lick stamp"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(0,0,0),(488,638,102,102),2)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Lick Stamp: Click",True,(0,0,0))
        txtPic2=tnmFont.render("on canvas to stamp",True,(0,0,0))
        txtPic3=tnmFont.render("image.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and blueRect.collidepoint((mx,my)):
        tool="blue stamp"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(0,0,0),(608,638,102,102),2)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Blue Stamp: Click",True,(0,0,0))
        txtPic2=tnmFont.render("on canvas to stamp",True,(0,0,0))
        txtPic3=tnmFont.render("image.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and tossRect.collidepoint((mx,my)):
        tool="toss stamp"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(0,0,0),(728,638,102,102),2)
        draw.rect(screen,(255,255,255),(848,638,102,102),2)
        draw.rect(screen,(0,0,0),(849,639,102,102),1)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Toss Stamp: Click",True,(0,0,0))
        txtPic2=tnmFont.render("on canvas to stamp",True,(0,0,0))
        txtPic3=tnmFont.render("image.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and booRect.collidepoint((mx,my)):
        tool="boo stamp"
        #shows the user the selected tool while taking away the outline from previous selected tool
        draw.rect(screen,(255,255,255),(23,98,52,52),2)
        draw.rect(screen,(255,255,255),(173,98,52,52),2)
        draw.rect(screen,(255,255,255),(23,158,52,52),2)
        draw.rect(screen,(255,255,255),(98,158,52,52),2)
        draw.rect(screen,(255,255,255),(173,158,52,52),2)
        draw.rect(screen,(255,255,255),(23,218,52,52),2)
        draw.rect(screen,(255,255,255),(98,218,52,52),2)
        draw.rect(screen,(255,255,255),(173,218,52,52),2)
        draw.rect(screen,(255,255,255),(23,278,52,52),2)
        draw.rect(screen,(255,255,255),(98,278,52,52),2)
        draw.rect(screen,(255,255,255),(173,278,52,52),2)
        draw.rect(screen,(255,255,255),(23,338,52,52),2)
        draw.rect(screen,(255,255,255),(98,338,52,52),2)
        draw.rect(screen,(255,255,255),(173,338,52,52),2)
        draw.rect(screen,(255,255,255),(23,398,52,52),2)
        draw.rect(screen,(255,255,255),(248,638,102,102),2)
        draw.rect(screen,(0,0,0),(249,639,102,102),1)
        draw.rect(screen,(255,255,255),(368,638,102,102),2)
        draw.rect(screen,(0,0,0),(369,639,102,102),1)
        draw.rect(screen,(255,255,255),(488,638,102,102),2)
        draw.rect(screen,(0,0,0),(489,639,102,102),1)
        draw.rect(screen,(255,255,255),(608,638,102,102),2)
        draw.rect(screen,(0,0,0),(609,639,102,102),1)
        draw.rect(screen,(255,255,255),(728,638,102,102),2)
        draw.rect(screen,(0,0,0),(729,639,102,102),1)
        draw.rect(screen,(0,0,0),(848,638,102,102),2)
        #shows the user how to use the tool in the help box
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Boo Stamp: Click",True,(0,0,0))
        txtPic2=tnmFont.render("on canvas to stamp",True,(0,0,0))
        txtPic3=tnmFont.render("image.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
    elif mb[0]==1 and musicplayRect.collidepoint((mx,my)):
        if music=="pause": #if the music was paused, it will unpause
            mixer.music.unpause()
        elif music=="stop": #if the music was stopped, it will restart
            mixer.music.play()
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Music: Play button",True,(0,0,0))
        txtPic2=tnmFont.render("starts the music. Pause",True,(0,0,0))
        txtPic3=tnmFont.render("button temporarily stops",True,(0,0,0))
        txtPic4=tnmFont.render("the music. Stop button",True,(0,0,0))
        txtPic5=tnmFont.render("stops the music.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        screen.blit(txtPic4,(800,55,150,80))
        screen.blit(txtPic5,(800,70,150,80))
    elif mb[0]==1 and musicpauseRect.collidepoint((mx,my)):
        mixer.music.pause()
        music="pause"
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Music: Play button",True,(0,0,0))
        txtPic2=tnmFont.render("starts the music. Pause",True,(0,0,0))
        txtPic3=tnmFont.render("button temporarily stops",True,(0,0,0))
        txtPic4=tnmFont.render("the music. Stop button",True,(0,0,0))
        txtPic5=tnmFont.render("stops the music.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        screen.blit(txtPic4,(800,55,150,80))
        screen.blit(txtPic5,(800,70,150,80))
    elif mb[0]==1 and musicstopRect.collidepoint((mx,my)):
        mixer.music.stop()
        music="stop"
        draw.rect(screen,(255,255,255),helpRect)
        draw.rect(screen,(0,0,0),(799,9,152,82),1)
        txtPic1=tnmFont.render("Music: Play button",True,(0,0,0))
        txtPic2=tnmFont.render("starts the music. Pause",True,(0,0,0))
        txtPic3=tnmFont.render("button temporarily stops",True,(0,0,0))
        txtPic4=tnmFont.render("the music. Stop button",True,(0,0,0))
        txtPic5=tnmFont.render("stops the music.",True,(0,0,0))
        screen.blit(txtPic1,(helpRect))
        screen.blit(txtPic2,(800,25,150,80))
        screen.blit(txtPic3,(800,40,150,80))
        screen.blit(txtPic4,(800,55,150,80))
        screen.blit(txtPic5,(800,70,150,80))
    #colour
    if mb[0]==1 and colourRect.collidepoint((mx,my)):
        drawColour=screen.get_at((mx,my))
    #Using the tools
    if mb[0]==1 and canvas.collidepoint((mx,my)):
        screen.set_clip(canvas)
        if tool=="pencil":
            draw.line(screen,drawColour,(oldmx,oldmy),(mx,my),drawSize)
        elif tool=="eraser":
            dist=hypot(oldmx-mx,oldmy-my)
            dist=max(1,dist)
            for i in range(int(dist)):
                x=int(mx+i/dist*(oldmx-mx))
                y=int(my+i/dist*(oldmy-my))
                draw.circle(screen,(255,255,255),(x,y),drawSize)
        elif tool=="brush":
            dist=hypot(oldmx-mx,oldmy-my) #hypotenuse of the right triangle
            dist=max(1,dist)
            for i in range(int(dist)): 
                x=int(mx+i/dist*(oldmx-mx))
                y=int(my+i/dist*(oldmy-my)) #finds each pixel location
                draw.circle(screen,drawColour,(x,y),drawSize)
        elif tool=="eyedropper":
            drawColour=screen.get_at((mx,my))
            tool=oldtool
        elif tool=="unfilled ellipse":
            screen.blit(copy,(0,0))
            sx,sy=(min(mx,start1),min(my,start2)) #ensures that the width and length are not negative
            width=(max(mx,start1))-sx
            length=(max(my,start2))-sy
            if min(width,length)<drawSize*2:
                draw.ellipse(screen,drawColour,(sx,sy,width,length)) #fills the ellipse if drawSize exceeds the rect
            else:
                draw.ellipse(screen,drawColour,(sx,sy,width,length),drawSize)
        elif tool=="unfilled rectangle":
            screen.blit(copy,(0,0))
            width=mx-start1
            length=my-start2
            rec=Rect(start1,start2,width,length)
            draw.rect(screen,drawColour,rec,drawSize)
            #draws smaller rectangles to fill in the blank space made by draw.rect
            draw.rect(screen,drawColour,(start1-drawSize/2+1,start2-drawSize/2+1,drawSize,drawSize))
            draw.rect(screen,drawColour,(start1-drawSize/2+1,start2+length-drawSize/2,drawSize,drawSize))
            draw.rect(screen,drawColour,(start1+width-drawSize/2,start2-drawSize/2+1,drawSize,drawSize))
            draw.rect(screen,drawColour,(start1+width-drawSize/2,start2+length-drawSize/2,drawSize,drawSize))
        elif tool=="spray paint":
            for i in range(6):
                randmx,randmy=(randint(mx-drawSize,mx+drawSize),randint(my-drawSize,my+drawSize)) #generates random values
                if hypot(randmx-mx,randmy-my)<drawSize:
                    draw.circle(screen,drawColour,(randmx,randmy),0)
        elif tool=="filled ellipse":
            screen.blit(copy,(0,0))
            sx,sy=min(mx,start1),min(my,start2)
            width=(max(mx,start1))-sx
            length=(max(my,start2))-sy
            ellipse=Rect(sx,sy,width,length)
            draw.ellipse(screen,drawColour,ellipse)
        elif tool=="filled rectangle":
            screen.blit(copy,(0,0))
            width=mx-start1
            length=my-start2
            rec=Rect(start1,start2,width,length)
            draw.rect(screen,drawColour,rec)
        elif tool=="line":
            screen.blit(copy,(0,0))
            draw.line(screen,drawColour,start,(mx,my),drawSize)
        elif tool=="polygon":
            if polydrawn==True:
                polypoints=[]
                polydrawn=False
            if (mx,my) in polypoints:
                pass
            else:
                polypoints.append((mx,my))
        elif tool=="load":
            #the user clicks on the canvas to blit the picture
            if done:
                screen.blit(copy,(0,0))
                screen.blit(loadPic,(mx,my))
                done=False
        elif tool=="omnom stamp":
            screen.blit(copy,(0,0))
            screen.blit(omnomPic,(mx-45,my-50))
        elif tool=="roto stamp":
            screen.blit(copy,(0,0))
            screen.blit(rotoPic,(mx-45,my-50))
        elif tool=="lick stamp":
            screen.blit(copy,(0,0))
            screen.blit(lickPic,(mx-45,my-50))
        elif tool=="blue stamp":
            screen.blit(copy,(0,0))
            screen.blit(bluePic,(mx-45,my-50))
        elif tool=="toss stamp":
            screen.blit(copy,(0,0))
            screen.blit(tossPic,(mx-45,my-50))
        elif tool=="boo stamp":
            screen.blit(copy,(0,0))
            screen.blit(booPic,(mx-45,my-50))
        screen.set_clip(None)
    if mb[2]==1 and canvas.collidepoint((mx,my)):
        screen.set_clip(canvas)
        if tool=="polygon":
            draw.polygon(screen,drawColour,polypoints,drawSize) #when the user right clicks the polygon is drawn
            polydrawn=True
        screen.set_clip(None)
    oldmx,oldmy=mx,my
    if tool!="eyedropper":
        oldtool=tool
    display.flip()
font.quit()
del tnmFont
quit()
