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

标签 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] 的位置似乎有一个不明确的/缩进错误,我是 python 的新手,想知道哪里出了问题?

最佳答案

在 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]

关于python - unident 不匹配任何外部缩进级别,我需要更改什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16167508/

相关文章:

Python 正则表达式如果组匹配则放置不同的字符

python - 在 Python 中重现随机生成关卡的最简单方法是什么?

python - 为什么这个缩进有效? Python

python - BeautifulSoup 插入 HTML 数据属性

Python。将标准输出重定向到套接字

python - 计算给定线 start(x,y) end(x,y) 上的投影点位置 (x,y)

python - pygame相当于settimeout? (x 毫秒后调用函数?)

python - Pygame 贪吃蛇游戏中的蛇长度

c++ - Vim 在 C++ 类中的格式化/自动缩进似乎不正确。这是正常的吗?

由于缩进而导致 Python 打印错误