Python 3.2.1; Pygame 1.9.2;无效的语法

时间:2011-07-19 04:33:36

标签: python syntax python-3.x pygame

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

    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”本身。

2 个答案:

答案 0 :(得分:4)

上一行中缺少)

作业只能是声明

快乐的编码。

答案 1 :(得分:4)

具体而言,screen.blit(background , (0,0)应为screen.blit(background , (0,0))