[Tutor] Fwd: Re: Problem handling keyboard commands
Alan Gauld
alan.gauld at btinternet.com
Wed Oct 9 18:52:32 EDT 2019
This didn't seem to come through on the list. If it now appears twice I
apologize in advance....
-------- Forwarded Message --------
Subject: Re: [Tutor] Problem handling keyboard commands
Date: Wed, 9 Oct 2019 17:23:52 +0100
From: Alan Gauld <alan.gauld at btinternet.com>
Reply-To: alan.gauld at yahoo.co.uk
To: tutor at python.org
On 09/10/2019 10:06, Cravan wrote:
> it appears that none of my keyboard commands in the event() are working. May I know what is the problem in my code?
>
> if event.type == pygame.K_f:
>
I believe that in pygame this should look like:
if event.type == pygame.KEYDOWN and event.key == pygame.K_f:
....
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list