我必须为一个学校项目写一个pygame程序,我遇到了一些关于mouse.set的问题。_位置
我需要在程序开始时设置鼠标位置。这里我将它设置在我的小窗口的中间,但是每次我运行它时,鼠标都没有被设置到我的窗口的中间……可能是因为它在while循环之外。
[...]
pygame.display.init()
running = True
positions = []
file_contents = {}
click_counter = 1
screen_y = 640
screen_x = 400
pygame.display.set_mode((screen_y, screen_x))
pygame.mouse.set_pos([screen_y / 2, screen_x / 2])
while running:
[...]
另一方面,当我尝试使用pygame.mouse.set_pos([screen_y / 2, screen_x / 2])
在我的while循环中,我的光标总是停留在给定的位置。
如何使用pygame.mouse.set_pos()
在某种程度上,我只能在开始时设置鼠标位置?
转载请注明出处:http://www.jxbyjx.net/article/20230522/1137879.html