[pygame] What is the use of 'pump' argument

13 views
Skip to first unread message

Ariel Burman

unread,
Sep 2, 2021, 12:20:03 PM9/2/21
to pygame...@seul.org
Hello,

with this small test code
```python
import pygame
import time

pygame.init()
gameDisplay = pygame.display.set_mode((100, 100))
running = True

while running:
    time.sleep(.1)

    events = pygame.event.get(eventtype=[pygame.KEYDOWN,pygame.KEYUP], pump=False)
    if events:
        print('important events')
        for ev in events:
            print('  ',ev)

    events2 = pygame.event.get()
    if events2:
        print('non important events')
        for ev in events2:
            print('  ',ev)
            if ev.type == pygame.QUIT:
                running = False

pygame.quit()
```

If pump is `False`, then the first event.get returns nothing, and the second event.get return all events.
If pump is `True` then the first event.get returns the selected event types, and event.get returns the remaining events. This is what I wanted but I understood that I was going to get this behavior setting `pump = False`.

What is the use of setting pump to False?

Thank you

--
Ariel Burman

Martin Stofcik

unread,
Nov 8, 2021, 11:36:56 AM11/8/21
to pygame...@seul.org
unsubscribe
Reply all
Reply to author
Forward
0 new messages