Computing project. I'm making a menu for a Math game and encountered a strange error. FYI I took most of this code off pygame.org. I get an invalid syntax error on my colon
at:
if name == 'main': main()
Why am I getting this error and how to fix it. I have never really coded before so assume my ignorance and don't be mean please.
Thank you very much :)
import pygame
nicegreen = (50, 200, 90)
black = (0, 0, 0)
def button (message, x, y, width, height, initialc, hoverc, action=None ):
mouse = pygame.mouse.get_pos()
click = pygame.mouse.get_pressed()
def main():
pygame.init()
screen = pygame.display.set_mode((640, 480))
pygame.display.set_caption('Math Game Project')
background = pygame.Surface(screen.get_size())
background = background.convert()
background.fill((50, 200, 90))
font = pygame.font.Font(None, 36)
text = font.render("Math Quest", 1, (120, 10, 10))
textpos = text.get_rect()
textpos.centerx = background.get_rect().centerx
background.blit(text, textpos)
# Blit everything to the screen
screen.blit(background, (0, 0))
pygame.display.flip()
# Event loop
while 1:
for event in pygame.event.get():
if event.type == QUIT:
return
startbutton(
screen.blit(background, (0, 0))
if __name__ == '__main__': main()