Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(34)  |  Call(34)  |  Derive(0)  |  Import(0)
Allows you to easily ask if a key was pressed. Uses pygame constants. 

src/p/y/pygame-fenix-HEAD/examples/process_interaction.py   pygame-fenix(Download)
 
            # Check for pressing escape
            if Program.key(K_ESCAPE):
                Program.quit()
 
 
            # Do input
            if Program.key(K_LEFT):
                self.angle += 10000
            if Program.key(K_RIGHT):
                self.angle -= 10000
            if Program.key(K_UP):
                speed += 2.0
            if Program.key(K_DOWN):

src/p/y/pygame-fenix-HEAD/examples/basic2.py   pygame-fenix(Download)
 
            # Check for pressing escape
            if Program.key(K_ESCAPE):
                Program.quit()
 
 
            # Do input
            if Program.key(K_LEFT):
                self.angle += 10000
            if Program.key(K_RIGHT):
                self.angle -= 10000
            if Program.key(K_UP):
                speed += 2.0
            if Program.key(K_DOWN):

src/p/y/pygame-fenix-HEAD/examples/basic.py   pygame-fenix(Download)
 
            # Check for pressing escape
            if Program.key(K_ESCAPE):
                Program.quit()
 
 
            # Do input
            if Program.key(K_LEFT):
                self.angle += 10000
            if Program.key(K_RIGHT):
                self.angle -= 10000
            if Program.key(K_UP):
                speed += 2.0
            if Program.key(K_DOWN):

src/p/y/pygame-fenix-HEAD/examples/size_angle_alpha.py   pygame-fenix(Download)
 
            # Check for pressing escape
            if Program.key(K_ESCAPE):
                Program.quit()
 

src/p/y/pygame-fenix-HEAD/examples/text.py   pygame-fenix(Download)
 
            # Check for pressing escape
            if Program.key(K_ESCAPE):
                Program.quit()
 

src/p/y/pygame-fenix-HEAD/examples/invaders/invaders.py   pygame-fenix(Download)
 
			# Simple input check
			if Program.key(K_ESCAPE):
				Program.exit()
 
			# Here we check if the ship should move left/right and change the x (horisontal)
			# coordinate appropriately.
			if Program.key(K_LEFT):
				self.x -= 4
			if Program.key(K_RIGHT):

src/s/c/scavenger-HEAD/main.py   scavenger(Download)
		while True:
 
			if Program.key(K_ESCAPE):
				Program.exit()
 
 
					# MOVEMENT
					if Program.key(K_UP) or Program.key(K_w) or Program.key(K_COMMA):
						if not start_fly:
							game.media.sounds['startfly'].play()
						start_fly = False
 
					if Program.key(K_DOWN) or Program.key(K_s) or Program.key(K_o):
						self.accel = -0.2  - (self.engine_level * 0.1)
					if Program.key(K_LEFT) or Program.key(K_a):