I'm making a game menu in Pygame, consider the following block of code:
pygame.init()
...
exit_button = pygame.image.load(r'/home/salem/Documents/MyGame/exit_b.png').convert_alpha()
cursor = pygame.image.load(r'/home/salem/Documents/MyGame/clicker.png').convert_alpha()
mouse = pygame.mouse.get_pos()
x, y = mouse
cursor_x = x + cursor.get_width() / 2
cursor_y = y + cursor.get_height() / 2
while 1:
...
menu.blit(exit_button, (10, 555))
menu.blit(cursor, (cursor_x, cursor_y))
if exit_button.get_rect(x=10, y=555).collidepoint(mouse):
exit()
pygame.display.update()
...
I'm experiencing some problems with the pygame.mouse module and get_rect method. They're not working correctly.
If I get the mouse position on the exit_button image while the script is running, nothing happens and it doesn't exit!
Furthermore, for some reason, the cursor's image is not being displayed, I can only see the system's cursor while moving the mouse though it's remarkably different from the cursor's image. (the system's cursor is black while the other one is white) At first, I thought they could be merged together, so to check that, I changed the cursor's coordinates but still the same result!
mouseorcursor_xorcursor_y, is that representative of your real running code? You should also consider always sharing a minimal verifiable example of your issue. \$\endgroup\$