Pro-grammer
Pro-grammer

Reputation: 870

Pygame event object

Is it possible to define an event object in pygame?

What I am trying to do is loop through all the keyboard events in a method, I then want to call that method with an event as a parameter, but I first need to define it. Is this possible?

Im using Pygame 3.3 and python 3.

Upvotes: 0

Views: 260

Answers (1)

ThisIsAQuestion
ThisIsAQuestion

Reputation: 1967

An event can be made with the command pygame.event.Event(type, dict). The type will be what you want it to return when the event.type() command is used on it. The dict will include every other attribute.

An example: pygame.event.Event(pygame.MOUSEBUTTONDOWN, {'button':1}) would return a MOUSEBUTTONDOWN event with an attribute button of 1.

Upvotes: 1

Related Questions