[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: Peter Shinners <pete@xxxxxxxxxxxx>
- Date: Fri, 02 Dec 2005 09:02:30 -0800
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Fri, 02 Dec 2005 12:02:37 -0500
- In-reply-to: <1133478714.14780.3.camel@localhost.homelan>
- References: <f495db580511271927q442c0667u87f51f6d321a713d@mail.gmail.com> <438CEDD9.7010300@softwave.se> <f495db580511291756j4a7ae797hb0957763c0cb2542@mail.gmail.com> <f495db580511291816o5c634474w3aea6be175a864b5@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>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
On Fri, 2005-12-02 at 00:11 +0100, Julien Peeters wrote:
> 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.
You should not need to track shift/meta/compose/caps/lock or any other
key modifier to get the user input. The KEYDOWN events come with a
"unicode" attribute, which is the fully translated character entered.
This means it will be capitalized, umlauted, and anything else the users
keyboard has control over.