[pygame] How to send a keyboard event ?
Hi I have a simple question : I want to create a class that generates keyboard event to test my application. Ex : I want a method to send this : event.type == KEYDOWN and event.key == K_KP_PLUS: Any pointers to help me doing this ? Thanks -- Pierre
Re: [pygame] How to send a keyboard event ?
I believe you can use pygame.event.fire_event()--unless I'm sorely mistaken. --Nazerine pierrelafran...@sympatico.ca wrote: Hi I have a simple question : I want to create a class that generates keyboard event to test my application. Ex : I want a method to send this : event.type == KEYDOWN and event.key == K_KP_PLUS: Any pointers to help me doing this ? Thanks
Re: [pygame] How to send a keyboard event ?
yeah, you can post in events with: pygame.event.post(Event(KEYDOWN, key=K_KP_PLUS)) cu, On Wed, Nov 11, 2009 at 5:59 PM, pierrelafran...@sympatico.ca pierrelafran...@sympatico.ca wrote: Hi I have a simple question : I want to create a class that generates keyboard event to test my application. Ex : I want a method to send this : event.type == KEYDOWN and event.key == K_KP_PLUS: Any pointers to help me doing this ? Thanks -- Pierre
Re: [pygame] How to send a keyboard event ?
You'd do something like: e = pygame.event.Event(pygame.KEYDOWN, {key: pygame.K_KP_PLUS}) pygame.event.post(e) pierrelafran...@sympatico.ca wrote: Hi I have a simple question : I want to create a class that generates keyboard event to test my application. Ex : I want a method to send this : event.type == KEYDOWN and event.key == K_KP_PLUS: Any pointers to help me doing this ? Thanks