0
我無法獲取此更新操縱桿軸以打印當前值。嘗試了pygame搖桿測試,並且工作,所以它不是遊戲杆問題。Python Pygame操縱桿不會更新
謝謝
import pygame
pygame.init()
clock = pygame.time.Clock()
class JoyStick():
def __init__(self):
pass
def update(self):
joystickOne = pygame.joystick.Joystick(0)
joystickOne.init()
self.axisOne = joystickOne.get_axis(1)
OP = JoyStick()
while True:
OP.update()
print(OP.axisOne)
clock.tick(10)
輸出保持0.0:
0.0
0.0
...
而不是寫'while done == False',你可以寫'while while not done' – marienbad