Question

Errr can some one help me with this. When I try to run the code i get this error: EOL while scanning string literal?????????

Here's my code (its the main menu of the game):

bif="menubg.jpg"
load_check_x = "null"
load_check_y = "null"
import pygame, sys
from pygame.locals import *
x = 0
y = 0

pygame.init()
screen=pygame.display.set_mode((640,360),0,32)
background=pygame.image.load(bif).convert()
screen.fill(BLACK)

class MainWindow:
  def __init__(self,screen):
         new_text = menu_font.render('Play!!!!', 1, (100, 100, 100))
         screen.blit(new_text, (340, 425))
         while True:

             evc = pygame.event.get()

             x,y = pygame.mouse.get_pos()
             #Setup mouse pos!!!
             if x >= 340 and x <= 465:
                load_check_x = "True"
             if x < 340 or x > 465:
                load_check_x = "False"

             if y >= 425 and y <= 445:
                load_check_y = "True"
             if y < 425 or y > 445:
                load_check_y = "False"

             if load_check_x == "True" and load_check_y == "True:
                for event.type == pygame.MOUSEBUTTONUP:
                    clear()

 def clear():
     screen.fill(BLACK)
Was it helpful?

Solution

As the syntax highlighting shows, you forgot a closing doublequote in your last if statement.

if load_check_x == "True" and load_check_y == "True:

should be...

if load_check_x == "True" and load_check_y == "True":
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top