def button(msg,x,y,w,h,ic,ac,action=None):
mouse = pygame.mouse.get_pos()
click = pygame.mouse.get_pressed()
#check position and draw the rectangle - takes the screen we set up gameDisplay. We will need to amend if using multiple screens
rect = (x,y,w,h)
if x+w > mouse[0] > x and y+h > mouse[1] > y:
pygame.draw.rect(gameDisplay, ac,rect)
if click[0] == 1 and action != None:
action()
else:
pygame.draw.rect(gameDisplay, ic,rect)
smallText = pygame.font.SysFont("arial",20)
textSurf, textRect = text_objects(msg, smallText)
textRect.center = ( (x+(w/2)), (y+(h/2)) )
gameDisplay.blit(textSurf, textRect)