[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] mouse scroll wheel
I've tried the following:
if event.type == pyame.MOUSEBUTTONDOWN:
print pygame.mouse.get_pressed
So pygame is seeing the event, but can't return to me any useful info.
Or am I trying to read this using the wrong function?
the "MOUSEBUTTONDOWN" event actually comes with a "button" attribute,
so you can know which button was pushed at the time of the event.
if event.type == pygame.MOUSEBUTTONDOWN:
print event.button
you can see a list of all the event types and the attributes they come
with near the top of the event documentation.
http://pygame.org/docs/ref/pygame_event.html
actually, for any type of mouse (and keyboard) event, you will want to
use the attributes that come with the event. inside a full game, it
may take a few milliseconds before an event can be processed. the user
could hit one of the three mouse buttons and by the time you called
pygame.mouse.get_pressed() it would already be released.