[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] How to get capital letters from key event
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] How to get capital letters from key event
- From: Rene Dudfield <renesd@xxxxxxxxx>
- Date: Fri, 2 Dec 2005 10:31:30 +1100
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Thu, 01 Dec 2005 18:31:35 -0500
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ZZoc83De7eBVxjuI/YAFEROQilQfc4E1WvH7ygEV9Ic+THSy4KP/LFsHyU5IzPGZDRRSjqq+F1Ui2vadWr8fjglrS5JzFTnOX3pQCN18gMwv4F3VkMHa+KMBcA7nZ1SEfzh/R33nol/3H1rIYTmn7f5LlcCPeTl7p/cnT5X1wbs=
- In-reply-to: <20051201231711.GD7822@asu.edu>
- References: <f495db580511291756j4a7ae797hb0957763c0cb2542@mail.gmail.com> <383b6d6f0511292354g10285f4cidec1fae246a933a8@mail.gmail.com> <438DA62C.7000904@softwave.se> <1133366099.10529.14.camel@localhost.localdomain> <f495db580511300934x4171ace7w93cbc8995bef5062@mail.gmail.com> <438DEBFF.4030804@softwave.se> <f495db580511301047t4f4f29a1hcc7577228582cc20@mail.gmail.com> <f495db580511301111m31838c10pf1bfc225c3c3a601@mail.gmail.com> <1133478714.14780.3.camel@localhost.homelan> <20051201231711.GD7822@asu.edu>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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
>