Python pygame 模块,K_o() 实例源码

我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用pygame.K_o()

项目:renpy-shader    作者:bitsawer    | 项目源码 | 文件源码
def update(self, frameNumber, editor):
        for event, pos in editor.context.events:
            if event.type == pygame.KEYDOWN:
                bone = editor.getActiveBone()
                key = event.key
                if key == pygame.K_i:
                    if bone:
                        if event.mod & pygame.KMOD_ALT:
                            if bone.name in self.frames[frameNumber].keys:
                                del self.frames[frameNumber].keys[bone.name]
                        else:
                            key = self.frames[frameNumber].getBoneKey(bone.name)
                            copyKeyData(bone, key)
                        self.dirty = True
                elif key == pygame.K_o:
                    if bone:
                        data = self.getBoneData(bone.name)
                        data.repeat = not data.repeat
                        self.dirty = True
                elif key == pygame.K_p:
                    if bone:
                        data = self.getBoneData(bone.name)
                        data.reversed = not data.reversed
                        self.dirty = True
项目:TetrisAI    作者:bbergrobots    | 项目源码 | 文件源码
def eventCheck( self ):
        for event in gui.event.get( ):
            if event.type == gui.QUIT:
                self.abort = True
            if event.type == gui.KEYDOWN:
                if event.key == gui.K_ESCAPE:
                    gui.event.post( gui.event.Event( gui.QUIT ) )
                if event.key == gui.K_LEFT:
                    self.cTile.decX( )
                if event.key == gui.K_RIGHT:
                    self.cTile.incX( )
                if event.key == gui.K_DOWN:
                    self.cTile.incY( )
                if event.key == gui.K_COMMA:
                    self.cTile.rotACW( )
                if event.key == gui.K_PERIOD:
                    self.cTile.rotCW( )
                if event.key == gui.K_RETURN:
                    self.cTile.drop( )
                if event.key == gui.K_p:
                    self.time.incSpeed( )
                if event.key == gui.K_o:
                    self.time.decSpeed( )
                if event.key == gui.K_a:
                    self.aiState = not self.aiState
            if event.type == gui.MOUSEBUTTONUP:
                if event.button == 1:
                    if gui.Rect( 480, 630, 101, 30 ).collidepoint( event.pos ):
                        self.infoMode = 0
                    if gui.Rect( 580, 630, 101, 30 ).collidepoint( event.pos ):
                        self.infoMode = 1
                    if gui.Rect( 680, 630, 101, 30 ).collidepoint( event.pos ):
                        self.infoMode = 2
                    if self.infoMode == 1:
                        if gui.Rect( 630, 405, 39, 30 ).collidepoint( event.pos ):
                            self.genomeScreen[ 0 ] = max( 0, self.genomeScreen[ 0 ]-1 )
                        if gui.Rect( 668, 405, 39, 30 ).collidepoint( event.pos ):
                            self.genomeScreen[ 0 ] = min( len( self.ai.population.generations )-1, self.genomeScreen[ 0 ]+1 )
                        if gui.Rect( 706, 405, 39, 30 ).collidepoint( event.pos ):
                            self.genomeScreen[ 1 ] = max( -1, self.genomeScreen[ 1 ]-1 )
                        if gui.Rect( 744, 405, 39, 30 ).collidepoint( event.pos ):
                            self.genomeScreen[ 1 ] = min( 39, self.genomeScreen[ 1 ]+1 )
项目:spassouno-py    作者:OfficineArduinoTorino    | 项目源码 | 文件源码
def keyboard_interaction():
    global current_text_tag,last_time_text,animation_speed,NEXT_CRITICAL_ACTION
    if IS_RASPBERRY:
        check_hardware_buttons()
    for event in pygame.event.get():
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE:
                    pygame.quit()
                    exit()
                elif event.key == pygame.K_SPACE:
                    camera.save_frame(frameManager)
                    current_text_tag="scattato"
                elif event.key == pygame.K_UP:
                    NEXT_CRITICAL_ACTION="changetosession"+str(frameManager.current_session+1)
                    current_text_tag="cambio sessione"
                elif event.key == pygame.K_DOWN:
                    NEXT_CRITICAL_ACTION="changetosession"+str(frameManager.current_session-1)
                    current_text_tag="cambio sessione"
                elif event.key == pygame.K_x:
                    frameManager.remove_frame()
                    current_text_tag="rimosso"
                elif event.key == pygame.K_s:
                    NEXT_CRITICAL_ACTION="save"
                    current_text_tag="saving"
                elif event.key == pygame.K_r:
                    camera.ruota()
                elif event.key == pygame.K_DELETE:
                    frameManager.delete_all()
                elif event.key == pygame.K_BACKSPACE:
                    frameManager.delete_current_scene()
                elif event.key == pygame.K_p:
                    animation_speed/=2.0
                    if animation_speed<0.003125:
                        animation_speed=0.003125
                elif event.key == pygame.K_o:
                    animation_speed*=2.0
                    if animation_speed>3.2:
                        animation_speed=3.2
                else:
                    for n in range(10):
                        if event.key == pygame.__dict__["K_"+str(n)]:
                            nf=n-1
                            if nf<0:
                                nf=9
                            NEXT_CRITICAL_ACTION="changetosession"+str(nf)
                            current_text_tag="cambio sessione"
                last_time_text=time.time()