Thanks, that's just what I needed! On Sun, Jun 28, 2009 at 7:49 PM, René Dudfield <[email protected]> wrote:
> events = pygame.event.get() > > for e in events: > if e.type == KEYDOWN: > if e.key == K_y: > if e.mod & KMOD_LSHIFT or e.mod & KMOD_RSHIFT: > do_with_shift() > else: > do_without_shift() > > Or you can use the pygame.key.get_mods: > http://pygame.org/docs/ref/key.html#pygame.key.get_mods > > > > > On Mon, Jun 29, 2009 at 9:32 AM, Evan Kroske<[email protected]> wrote: > > I'm trying to make a game with pygame2, but I'm having trouble figuring > out > > how to use the shift and control keys to control the game. I understand > that > > Event.mod returns a number that you can compare to the sdl mod key > constants > > to determine what mod keys are being pressed. However, I also understand > > that you have to do some kind of bitwise operation to accomplish this, > and I > > have no idea how to do that. > > Assuming that pygame is similar to pygame2 in this respect, could > somebody > > give me a code snippet to demonstrate how to detect if a mod key is being > > pressed? Thanks. > > Evan Kroske >
