Code corresponding to "when clicking" in pygame

Asked 2 years ago, Updated 2 years ago, 92 views

I want to put the quit button in the game code in pygame, but I know how to turn off the game program by putting the quit button. The problem is that I wanted to change the color when I was clicking the quit button, so I made another darker picture, but I don't know the code for "When I'm clicking." Can I know the code when I click on Python?

python button

2022-09-22 17:54

1 Answers

This is when the mouse button is clicked with pygame.MOUSEBUTTONDOWN.

This is when you release the mouse button with pygame.MOUSEBUTTONUP.

That's when you click until you release the mouse.


2022-09-22 17:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.