[Python] pygame.mouse.set_pos TypeError: 'tuple' object is not callable [duplicate]

Discussão em 'Python' iniciado por Stack, Abril 27, 2025.

  1. Stack

    Stack Membro Participativo

    When i try to call the pygame.mouse.set_pos() function, I am getting a strange error.

    if event.type == pygame.MOUSEMOTION:
    mousePosition.x += event.rel[0]
    mousePosition.y -= event.rel[1]
    scene.setViewMatrix(cameraPosition, mousePosition.x * .001, mousePosition.y * .001)
    pygame.mouse.set_pos((halfScreenSize.x, halfScreenSize.y))


    this is what python shows when I try to run it.

    PS C:\Users\aprettydopecat\OneDrive\Documents\Coding\python\gamejam-practice> py main.py
    pygame-ce 2.5.3 (SDL 2.30.12, Python 3.11.0)
    Traceback (most recent call last):
    File "C:\Users\aprettydopecat\OneDrive\Documents\Coding\python\gamejam-practice\main.py", line 100, in <module>
    pygame.mouse.set_pos((halfScreenSize.x, halfScreenSize.y))
    TypeError: 'tuple' object is not callable```

    Continue reading...

Compartilhe esta Página