pygame question
Terry Reedy
tjreedy at udel.edu
Thu Jul 11 21:35:29 EDT 2002
"Michael Bauers" <me at michaelbauers.com> wrote in message
news:uis3ccnreo0u32 at corp.supernews.com...
> I was curious as to why 'is K_SPACE' worked, but 'is K_r' did not.
I had to
> change the test for 'r' to ==.
>
> * code snippet *
> elif (event.type is KEYDOWN and event.key is
> K_SPACE):
> # DO SOMETHING
> elif (event.type is KEYDOWN and
> event.key == K_r):
> # DO SOMETHING ELSE
I don't know about your question, but I do about eliminating redundant
code 8-)
I would redo as
elif event.type == KEYDOWN:
keyhit = event.key
if keyhit == K_SPACE: #do x
elif keyhit == K_r: # do y
Should K_r be K_R? What was your error message? (ie, what does 'not
work' mean?)
Terry J. Reedy
More information about the Python-list
mailing list