[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] How to get capital letters from key event



instead of pygame.ket.get_mods()

Use the event.mod attribute of that key event.  Otherwise someone may
quickly type aBcD and you might link the wrong keys up with which are
caps or not.

if event.mod & KMOD_SHIFT:
    # it is a shifted key.

More details here:
http://www.pygame.org/docs/ref/key.html


On 12/2/05, Randy Kaelber <randy@xxxxxxxxxxxx> wrote:
> On Fri, Dec 02, 2005 at 12:11:54AM +0100, Julien Peeters wrote:
> > Hello everybody,
> >
> > I am implementing a TextLabel widget with pygame but I can't get capital
> > letters. I get the name of pressed key with pygame.key.name(event.key),
> > but when I pressed Shift+<letter> I do not get I expect.
> >
> > Do have I use a FIFO ?
>
>
> Try pygame.key.get_mods()  and you can tell if shift (or ctrl and alt for
> that matter) are down.
>
> >
> > Thanks for answers.
> >
>
> --
> Randy Kaelber                                        randy@xxxxxxxxxxxx
> Scientific Software Engineer
> Mars Space Flight Facility, Department of Geological Sciences
> Arizona State University, Tempe, Arizona, USA
>