Use Pygame mouse while hidden

2019-09-11 07:45发布

问题:

Is there a way to use the mouse while,

pygame.mouse.set_visible(False)

is activated. Currently mouse only returns the bottom-right coordinate when tried to be used. Being able to get correct coordinates while mouse is hidden is required.

Could not find an answer at their documentation.

回答1:

I solved the problem by using an invisible cursor.

pygame.mouse.set_cursor((8,8),(0,0),(0,0,0,0,0,0,0,0),(0,0,0,0,0,0,0,0))