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

Re: [pygame] key objets



Michal Molhanec wrote:
> Gerrit Holl wrote:
> >Hi,
> >
> >I propose to change Pygame's key behaviour to make it more object-oriented.
> >A key number could be a subclass of int, but supporting methods like
> >.isalpha() (Has the user pressed a letter?), .isarrow() (Has the user 
> >pressed
> >an arrow?). Too often, I see myself doing "if K_a <= key <= K_z". I think a
> >more high-level approach would be useful.
> 
> maybe you can use something like:
> e.unicode.isalpha()
> (where e is instance of Event)

Hmm, I didn't know .unicode but it seems it is only defined if it is a
character: so for arrows, function keys, etc., it seems not to be defined.

> but i'm new to pygame so sorry if i'm wrong

But thanks anyway, it does help.

yours,
Gerrit.

-- 
114. If a man have no claim on another for corn and money, and try to
demand it by force, he shall pay one-third of a mina of silver in every
case.
        -- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/