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

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



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.