unindent与任何外部缩进级别不匹配,我需要更改什么?

时间:2013-04-23 10:53:54

标签: python pygame indentation

def update(self):
        # Get the current mouse position. This returns the position
        # as a list of two numbers
         pos = pygame.mouse.get_pos()

        # Fetch the x and y out of the list,
        # just like we'd fetch letters out of a string.
        # Set the player object to the mouse location
        self.circ.x=pos[0]
        self.circ.y=pos[1]

初始化Pygame

在self.circ.x = pos [0]的地方似乎有一个unident / indentation错误,我是python的新手并且想知道出了什么问题?

3 个答案:

答案 0 :(得分:2)

在pos变量删除之前你有一个空格。

def update(self):
    # Get the current mouse position. This returns the position
    # as a list of two numbers
    pos = pygame.mouse.get_pos()

    # Fetch the x and y out of the list,
    # just like we'd fetch letters out of a string.
    # Set the player object to the mouse location
    self.circ.x=pos[0]
    self.circ.y=pos[1]

答案 1 :(得分:1)

Pos位于右侧。

答案 2 :(得分:1)

该行

         pos = pygame.mouse.get_pos()

有一个额外的空间。要清楚地看到这一点,删除评论会有所帮助。

         pos = pygame.mouse.get_pos()
        self.circ.x=pos[0]
        self.circ.y=pos[1]