Python 3.2.1;Pygame 1.9.2;无效语法

2024-10-08 18:25:52 发布

您现在位置:Python中文网/ 问答频道 /正文

当我试图运行以下程序时,我收到一个语法错误通知:

    balli = "ball.png"
    backgroundi = "background.png"

    import pygame , sys
    from pygame.locals import *

    pygame.init()

    screen = pygame.display.set_mode((500,500) , 0 , 32)
    background = pygame.image.load(backgroundi).convert()
    cursor = pygame.image.load(balli).convert_alpha()

    while 1:
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()

        screen.blit(background , (0,0)

        x,y = pygame.mouse.get_pos()
        x -= cursor.get_width()/2
        y -= cursor.get_height()/2

        screen.blit(cursor , (x,y))

        pygame.display.update()

这个问题似乎一直存在于以“x”开头并带有“x”本身的那条线上。在


Tags: imageimporteventconvertgetpngdisplaysys

热门问题