Errr可以帮助我解决这个问题。当我尝试运行代码时,我收到此错误:EOL扫描字符串文字时?????????
这是我的代码(它是游戏的主菜单):
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)
答案 0 :(得分:2)
正如语法高亮显示的那样,您忘记了上一个if语句中的结束双引号。
if load_check_x == "True" and load_check_y == "True:
应该是......
if load_check_x == "True" and load_check_y == "True":