Examples for pygame.Event

pygame.time.get_ticks()

Returns - milliseconds

returns the number of milliseconds since pygame.init() was called

pygame.time.Clock()

Returns - Clock Object

This function is used to create a clock object which can be used to keep track of time. The various methods of clock object are: tick(), get_time(), get_fps()

pygame.time.wait()

Returns - Time

Will pause for a given number of milliseconds. This function sleeps the process to share the processor with other programs. A program that waits for even a few milliseconds will consume very little processor time. It is slightly less accurate than the pygame.time.delay() function.

pygame.time.delay()

Returns - Time

Will pause for a given number of milliseconds. This function will use the processor (rather than sleeping) in order to make the delay more accurate than pygame.time.wait().

pygame.time.set_timer()

Returns - None

pygame.time.set_timer() schedules a recurring event to be added to the event queue every given number of milliseconds. The event parameter specifies the type of event to add, and loops controls how many times the event is added. Setting millis to 0 disables the timer. Each event type can only have one timer at a time. The once parameter has been replaced by loops