Reputation: 367
My code is here:
import pygame as pg
pg.init()
while 1:
print(True in pg.key.get_pressed())
key.get_pressed
returns a tuple of booleans, one for each key on the keyboard. True in
should check to see if any of them are true, but the result is always False
What am I doing wrong?
If necessary, I am using python 3.4 and am on Windows.
Upvotes: 0
Views: 218
Reputation: 101052
key.get_pressed()
needs a window to work, so you should create one with
pg.display.set_mode((100,100)) # or whatever size you want
first.
Upvotes: 2