Python pygame.K_RCTRL Examples

The following are 1 code examples of pygame.K_RCTRL(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pygame , or try the search function .
Example #1
Source File: Base.py    From three.py with MIT License 5 votes vote down vote up
def run(self):

        self.initialize()
        
        while self.running:
        
            # update input state (down, pressed, up)
            self.input.update()
    
            if self.input.quit():
                self.running = False

            # debug tools
            
            # print FPS (Ctrl+F)
            if (self.input.isKeyPressed(pygame.K_LCTRL) or self.input.isKeyPressed(pygame.K_RCTRL)) and self.input.isKeyDown(pygame.K_f):
                fps = self.clock.get_fps()
                print( "FPS: " + str(int(fps)) )
                
            # save screenshot (Ctrl+S)
            if (self.input.isKeyPressed(pygame.K_LCTRL) or self.input.isKeyPressed(pygame.K_RCTRL)) and self.input.isKeyDown(pygame.K_s):
                timeString = str( int(1000 * time.time()) )
                fileName = "image-" + timeString + ".png"
                pygame.image.save(self.screen, fileName)
                
            self.deltaTime = self.clock.get_time() / 1000.0
            
            self.update()
            
            # display image on screen
            pygame.display.flip()

            # limit to 60 FPS
            self.clock.tick(60)

        # end of program
        pygame.quit()
        sys.exit()