我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用pygame.K_F11。
def Refresh(self): self.screen.fill((255,255,255)) self.App.Refresh() pygame.display.update() if not pygame.key.get_pressed()[pygame.K_LCTRL]: self.flag = False if not pygame.key.get_pressed()[pygame.K_LCTRL]: self.flag = False if pygame.key.get_pressed()[pygame.K_LCTRL] and pygame.key.get_pressed()[pygame.K_s] and not self.flag: self.flag = True name = str( time.time() )+ ".png" pygame.image.save(self.screen , str( time.time() )+ ".png") print "screenshot ",name," saved" if pygame.key.get_pressed()[ pygame.K_F11 ] and not self.lastpresssed: self.lastpresssed = True if self.fullscreen == 0: self.screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT),pygame.FULLSCREEN) self.fullscreen = 1 else: self.fullscreen = 0 self.screen = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT)) if not pygame.key.get_pressed()[pygame.K_F11]: self.lastpresssed = False