python类KEYUP的实例源码

core.py 文件源码 项目:project_xcape 作者: OthmanEmpire 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def handleEvent(self, _):
        for event in pg.event.get():

            if event.type == pg.QUIT:
                sys.exit()
            if event.type == pg.KEYDOWN:
                if event.key == pg.K_F4:
                    sys.exit()

            if (event.type == self.MENU_EVENT
                    or event.type == pg.KEYDOWN):
                self.menuEngine.handleEvent(event)

            if (event.type == self.SCENE_EVENT
                    or event.type == pg.KEYDOWN
                    or event.type == pg.KEYUP):
                self.sceneEngine.handleEvent(event)

            if (event.type == self.CUTSCENE_EVENT
                    or event.type == pg.KEYDOWN):
                self.cutsceneEngine.handleEvent(event)
player.py 文件源码 项目:Tutoriales_juegos_Python 作者: tidus747 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def handle_event(self, event):
        if event.type == pygame.QUIT:
            game_over = True

        if event.type == pygame.KEYDOWN:

            if event.key == pygame.K_LEFT:
                self.update('left')
            if event.key == pygame.K_RIGHT:
                self.update('right')
            if event.key == pygame.K_UP:
                self.update('up')
            if event.key == pygame.K_DOWN:
                self.update('down')

        if event.type == pygame.KEYUP:

            if event.key == pygame.K_LEFT:
                self.update('stand_left')
            if event.key == pygame.K_RIGHT:
                self.update('stand_right')
            if event.key == pygame.K_UP:
                self.update('stand_up')
            if event.key == pygame.K_DOWN:
                self.update('stand_down')
Physics 2.0.py 文件源码 项目:Physics-2.0 作者: rschwa6308 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def handle_events(*args):
    settings_window, camera, scroll, done, dims, screen, bodies, G, COR = args
    for event in pg.event.get():
        if event.type == pg.VIDEORESIZE:
            width, height = event.w, event.h
            dims, screen = V2(width, height), pg.display.set_mode((width, height), pg.RESIZABLE)
        elif event.type == pg.KEYDOWN:
            scroll.key(event.key, 1)
            camera.key_down(event.key)
        elif event.type == pg.KEYUP:
            scroll.key(event.key, 0)
            camera.key_up(event.key)
        elif event.type == pg.MOUSEBUTTONDOWN:
            handle_mouse(settings_window, camera, event, bodies, dims, G, COR, scroll)
        done |= event.type == pg.QUIT
    return done, dims, screen
asteroid invasion.py 文件源码 项目:asteroid-invasion 作者: mally1mk 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def showscreen():   
    BG()
    draw_text(screen, "asteroid invasion", 50, WIDTH / 2, HEIGHT / 4)
    draw_text(screen, "left and right arrow to move", 20,WIDTH / 2, HEIGHT / 2-12.5)
    draw_text(screen, "press space to shoot", 20,WIDTH / 2, HEIGHT / 2-50)
    draw_text(screen, "if red bar turns green ", 20,WIDTH / 2, HEIGHT / 2+22)
    draw_text(screen, "press arrow up to use sonicshot", 20,WIDTH / 2, HEIGHT / 2+44)
    draw_text(screen,'highscore: '+str(highscore),18,WIDTH/2,400)
    draw_text(screen, "Press up arrow to start", 18, WIDTH / 2, HEIGHT * 3 / 4)
    pygame.display.flip()
    waiting = True
    while waiting:
        clock.tick(FPS)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                exit()
                pygame.exit()
            if event.type == pygame.KEYUP:
                if event.key == pygame.K_UP:
                    waiting = False
__init__.py 文件源码 项目:spygame 作者: sven1977 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def tick(self):
        """
        Pulls all keyboard events from the event queue and processes them according to our keyboard_registry/descriptions.
        Triggers events for all registered keys like: 'key_down.[desc]' (when  pressed) and 'key_up.[desc]' (when released),
        where desc is the lowercase string after `pygame.K_`... (e.g. 'down', 'up', etc..).
        """
        events = pygame.event.get([pygame.KEYDOWN, pygame.KEYUP])
        for e in events:
            # a key was pressed that we are interested in -> set to True or False
            if e.key in self.keyboard_registry:
                if e.type == pygame.KEYDOWN:
                    self.keyboard_registry[e.key] = True
                    self.trigger_event("key_down." + self.descriptions[e.key])
                else:
                    self.keyboard_registry[e.key] = False
                    self.trigger_event("key_up." + self.descriptions[e.key])
Event_editor.py 文件源码 项目:Jeff-Long-Run 作者: matthiasrigaud 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def manager(field):
    put_tile = False
    for event in pygame.event.get():
        if event.type == pygame.QUIT or (event.type == pygame.KEYDOWN and event.dict["key"] == pygame.K_ESCAPE):
            sys.exit()
        elif event.type == pygame.KEYDOWN and (event.dict["key"] == pygame.K_RIGHT or event.dict["key"] == pygame.K_d):
            field.change_right_move(True)
        elif event.type == pygame.KEYUP and (event.dict["key"] == pygame.K_RIGHT or event.dict["key"] == pygame.K_d):
            field.change_right_move(False)
        elif event.type == pygame.KEYDOWN and (event.dict["key"] == pygame.K_LEFT or event.dict["key"] == pygame.K_q):
            field.change_left_move(True)
        elif event.type == pygame.KEYUP and (event.dict["key"] == pygame.K_LEFT or event.dict["key"] == pygame.K_q):
            field.change_left_move(False)
        elif event.type == pygame.MOUSEBUTTONDOWN and event.dict["button"] == 4:
            field.change_tile(1)
        elif event.type == pygame.MOUSEBUTTONDOWN and event.dict["button"] == 5:
            field.change_tile(-1)
        elif event.type == pygame.MOUSEBUTTONDOWN and event.dict["button"] == 1:
            field.put_tile()
Event.py 文件源码 项目:Jeff-Long-Run 作者: matthiasrigaud 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def manager(jeff, field, frame, level_select):
    for event in pygame.event.get():
        if event.type == pygame.QUIT or (event.type == pygame.KEYDOWN and event.dict["key"] == pygame.K_ESCAPE):
            sys.exit()
        elif event.type == pygame.KEYDOWN and jeff.is_dead() and event.dict["key"] == pygame.K_r:
            jeff = Jeff.Jeff([300, Constant.GROUND_HEIGHT - 50])
            field.reload_level()
        elif event.type == pygame.KEYDOWN and (jeff.is_dead() or field.is_level_ended()) and event.dict["key"] == pygame.K_m:
            jeff = Jeff.Jeff([300, Constant.GROUND_HEIGHT - 50])
            frame = "MENU"
        elif event.type == pygame.KEYDOWN and field.is_level_ended() and event.dict["key"] == pygame.K_n:
            next_level = level_select.get_next_level(field.get_level_file())
            if next_level != "":
                jeff = Jeff.Jeff([300, Constant.GROUND_HEIGHT - 50])
                field.load_level(next_level)
        elif event.type == pygame.KEYDOWN and event.dict["key"] == pygame.K_SPACE:
            jeff.jump(True)
        elif event.type == pygame.KEYUP and event.dict["key"] == pygame.K_SPACE:
            jeff.jump(False)
    return jeff, frame
test_input.py 文件源码 项目:pytari2600 作者: ajgrah2000 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_input(self):
        i = inputs.Input()
        test_inputs = [(pygame.KEYDOWN, {'key':pygame.K_1}),
                       (pygame.KEYDOWN, {'key':pygame.K_2}),
                       (pygame.KEYDOWN, {'key':pygame.K_2}),
                       (pygame.KEYDOWN, {'key':pygame.K_UP}),
                       (pygame.KEYDOWN, {'key':pygame.K_LEFT}),
                       (pygame.KEYUP,   {'key':pygame.K_r}),
#                       (pygame.KEYDOWN, {'key':pygame.K_q})
                       ]
        for e in [pygame.event.Event(*x) for x in test_inputs]:
            i.handle_events(e)

        self.assertEqual(i.get_swcha(),   0xAF)
        self.assertEqual(i.get_swchb(),   0x7F)
        self.assertEqual(i.get_paddle0(),  0x1)
        self.assertEqual(i.get_input7(),  0xFF)
slider.py 文件源码 项目:Peppy 作者: project-owner 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def mouse_action(self, event):
        """ Mouse event handler

        :param event: event to handle
        """
        pos = event.pos

        if self.selected and not(self.last_knob_position < pos[0] < self.last_knob_position + self.knob_width and pos[1] > self.bounding_box.y) and event.type != pygame.KEYUP:
            return

        button_press_simulation = getattr(event, "p", None)

        if event.type == pygame.MOUSEBUTTONUP and self.clicked:
            self.release_action(pos)                
        elif event.type == pygame.MOUSEBUTTONDOWN and self.bounding_box.collidepoint(pos):
            self.press_action()            
        elif event.type == pygame.MOUSEMOTION and (pygame.mouse.get_pressed()[0] or button_press_simulation) and self.bounding_box.collidepoint(pos) and self.clicked:
            self.motion_action(pos)
dispatcher.py 文件源码 项目:Peppy 作者: project-owner 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def handle_keyboard_event(self, event):
        """ Keyboard event handler. 

        Wraps keyboard events into user event. Exits upon Ctrl-C. 
        Distinguishes key up and key down.

        :param event: event to handle
        """        
        keys = pygame.key.get_pressed() 
        if (keys[pygame.K_LCTRL] or keys[pygame.K_RCTRL]) and event.key == pygame.K_c: 
            self.shutdown(event)
        elif event.type == pygame.KEYDOWN or event.type == pygame.KEYUP:
            if self.screensaver_dispatcher.saver_running:
                self.screensaver_dispatcher.cancel_screensaver()
                return
            self.handle_event(event)
            d = {}
            d[KEY_SUB_TYPE] = SUB_TYPE_KEYBOARD
            d[KEY_ACTION] = event.type
            d[KEY_KEYBOARD_KEY] = event.key
            event = pygame.event.Event(USER_EVENT_TYPE, **d)            
            pygame.event.post(event)
game_functions1262.py 文件源码 项目:Pythonlearn 作者: godzoco 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def check_events(ship):
    """???? 126 ????ship ??ship"""

    #??elif event.type == pygame.KEYDOWN:
    #???? ???? ????? ??
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
                #event.type == pygame.QUIT: ?????????
            sys.exit()
            '''???? ?? 1262?? ???????? ?????
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_RIGHT:
                ship.rect.centerx += 1
            '''
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_RIGHT:
                ship.moving_right = True
        elif event.type == pygame.KEYUP:
            if event.key == pygame.K_RIGHT:
                ship.moving_right = False
game_functions1263.py 文件源码 项目:Pythonlearn 作者: godzoco 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def check_events(ship):
    """???? 126 ????ship ??ship"""

    #??elif event.type == pygame.KEYDOWN:
    #???? ???? ????? ??
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
                #event.type == pygame.QUIT: ?????????
            sys.exit()
            '''???? ?? 1262?? ???????? ?????
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_RIGHT:
                ship.rect.centerx += 1
            '''
            #??down ???? ??????????  ??? ??? ??  ? ????? ? ? ????
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_RIGHT:
                ship.moving_right = True
            if event.key == pygame.K_LEFT:
                ship.moving_left = True
        elif event.type == pygame.KEYUP:
            if event.key == pygame.K_RIGHT:
                ship.moving_right = False
            if event.key == pygame.K_LEFT:
                ship.moving_left = False
main.py 文件源码 项目:zeroids-16.2 作者: ProgrammaBol 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def handle_events():
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit(0)
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_UP:
                player_one.speed = 10
            if event.key == pygame.K_RIGHT:
                player_one.angular_speed = 5
            if event.key == pygame.K_LEFT:
                player_one.angular_speed = -5
        if event.type == pygame.KEYUP:
            if event.key == pygame.K_UP:
                player_one.speed = 0
            if event.key == pygame.K_RIGHT:
                player_one.angular_speed = 0
            if event.key == pygame.K_LEFT:
                player_one.angular_speed = 0
slither.py 文件源码 项目:Slither 作者: PySlither 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def runMainLoop(frameFunc):
    while True:
        blit(globalscreen)
        frameFunc()
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                if runQuitCallback():
                    # runQuitCallback would run the function
                    # given to setQuitCallback, and return its result
                    pygame.quit()
                    sys.exit()
            else:
                if event.type == pygame.KEYDOWN:
                    keysPressed.append(pygame.key.name(event.key))
                elif event.type == pygame.KEYUP:
                    keysPressed.remove(pygame.key.name(event.key))
                eventCallbacks[event.type](event)
                # eventCallbacks would be a dictionary mapping
                # event types to handler functions.
        pygame.display.flip() # Always flip at the end
        clock.tick(projectFPS) # Run at however many FPS the user specifies
player_inputs.py 文件源码 项目:Snakis 作者: fbessou 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def read(self):
        inputs = []
        unused_events = []
        while True:
            event = pygame.event.poll()
            if event.type == pygame.NOEVENT:
                break

            keydown = False
            used = False
            if event.type == pygame.KEYDOWN:
                keydown = True
            if event.type == pygame.KEYUP or keydown:
                for player in range(len(self._mapping)):
                    if event.key in self._mapping[player]:
                        inputs.append(PlayerInput(player, self._mapping[player][event.key], keydown))
                        used = True
            if not used:
                unused_events.append(event)

        for event in unused_events:
            pygame.event.post(event)

        return inputs
input.py 文件源码 项目:LovelySpace 作者: lmb753 项目源码 文件源码 阅读 43 收藏 0 点赞 0 评论 0
def Refresh(self):
        self.ResetKeys()
        events = pygame.event.get()
        for event in events:
            if(event.type == pygame.KEYDOWN):
                self.CheckInputCache(event.key)
                self.pressed[event.key] = True
                self.keyDown[event.key] = True

                self.instantKey = event.key

            elif(event.type == pygame.KEYUP):
                self.pressed[event.key] = False
                self.keyUp[event.key] = True

            elif(event.type == pygame.MOUSEBUTTONDOWN):
                self.pressed[self.mouseButtons[event.button-1]] = True
                self.btnDown[self.mouseButtons[event.button-1]] = True

            elif(event.type == pygame.MOUSEBUTTONUP):
                self.pressed[self.mouseButtons[event.button-1]] = False
                self.btnUp[self.mouseButtons[event.button-1]] = True
pygame_tutorial_3.py 文件源码 项目:uit-inf-1400-2017.github.io 作者: uit-inf-1400-2017 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def handle_events(self):
    for event in pygame.event.get():
      if event.type == pygame.QUIT:
    exit()
      elif event.type == pygame.KEYDOWN:
    if event.key == pygame.K_UP:
      self.up_pressed = True
    elif event.key == pygame.K_DOWN:
      self.down_pressed = True
    elif event.key == pygame.K_LEFT:
      self.left_pressed = True
    elif event.key == pygame.K_RIGHT:
      self.right_pressed = True
    elif event.key == pygame.K_ESCAPE:
      exit()
      elif event.type == pygame.KEYUP:
    if event.key == pygame.K_UP:
      self.up_pressed = False
    elif event.key == pygame.K_DOWN:
      self.down_pressed = False
    elif event.key == pygame.K_LEFT:
      self.left_pressed = False
    elif event.key == pygame.K_RIGHT:
      self.right_pressed = False
sim.py 文件源码 项目:planet-hopper 作者: reddit-pygame 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def get_event(self, event):
        if event.type == pg.QUIT:
            self.quit = True
        elif event.type == pg.KEYUP:
            if event.key == pg.K_ESCAPE:
                self.quit = True
            elif event.key == pg.K_SPACE:
                self.running_sim = not self.running_sim
            elif event.key == pg.K_UP:
                if self.tick_index < len(self.tick_lengths) - 1:
                    self.tick_index += 1
                    self.tick_length = self.tick_lengths[self.tick_index]
            elif event.key == pg.K_DOWN:
                if self.tick_index > 0:
                    self.tick_index -= 1
                    self.tick_length = self.tick_lengths[self.tick_index]
game_functions.py 文件源码 项目:alien_invasion 作者: samnew 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def check_events(ai_settings, screen, stats, sb, play_button, ship, aliens, bullets):
    """?????????"""
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            stats.save_high_score()
            sys.exit()

        elif event.type == pygame.KEYDOWN:
            check_keydown_events(event, ai_settings, screen, stats,sb, ship, aliens, bullets)
        elif event.type == pygame.KEYUP:
            check_keyup_events(event, ship)
        elif event.type == pygame.MOUSEBUTTONDOWN:
            mouse_x, mouse_y = pygame.mouse.get_pos()
            check_play_button(ai_settings, screen, stats, sb, play_button, ship, aliens, bullets, mouse_x, mouse_y)
event.py 文件源码 项目:PyCut 作者: FOSSRIT 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def _keyup_cb(self, widget, event):
        key = event.keyval
        if self.__repeat[0] is not None:
            if key in self.__held:
                # This is possibly false if set_repeat() is called with a key held
                del self.__held_time_left[key]
                del self.__held_last_time[key]
        self.__held.discard(key)

        return self._keyevent(widget, event, pygame.KEYUP)
event.py 文件源码 项目:PyCut 作者: FOSSRIT 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def _keyevent(self, widget, event, type):
        key = Gdk.keyval_name(event.keyval)
        if key is None:
            # No idea what this key is.
            return False 

        keycode = None
        if key in self.key_trans:
            keycode = self.key_trans[key]
        elif hasattr(pygame, 'K_'+key.upper()):
            keycode = getattr(pygame, 'K_'+key.upper())
        elif hasattr(pygame, 'K_'+key.lower()):
            keycode = getattr(pygame, 'K_'+key.lower())
        elif key == 'XF86Start':
            # view source request, specially handled...
            self._mainwindow.view_source()
        else:
            print 'Key %s unrecognized' % key

        if keycode is not None:
            if type == pygame.KEYDOWN:
                mod = self._keymods()
            self.__keystate[keycode] = type == pygame.KEYDOWN
            if type == pygame.KEYUP:
                mod = self._keymods()
            ukey = unichr(Gdk.keyval_to_unicode(event.keyval))
            if ukey == '\000':
                ukey = ''
            evt = pygame.event.Event(type, key=keycode, unicode=ukey, mod=mod)
            self._post(evt)

        return True
game_functions.py 文件源码 项目:pyclimber 作者: manixaist 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def check_events(settings, screen, tile_map):
    """Watch for keyboard and mouse events"""
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()

        elif event.type == pygame.KEYDOWN:
            check_keydown_events(settings, event, screen, tile_map)
        elif event.type == pygame.KEYUP:
            check_keyup_events(settings, event, screen, tile_map)
players.py 文件源码 项目:project_xcape 作者: OthmanEmpire 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def handleEvent(self, event):
        if event.type == pg.KEYDOWN:
            if event.key == self.keybinds["jump"]:
                self.jump()

        if event.type == pg.KEYUP:
            if event.key == self.keybinds["move_left"]:
                self.stop()
            if event.key == self.keybinds["move_right"]:
                self.stop()
game_functions.py 文件源码 项目:Galaxian-Against-COMP140 作者: tomjlw 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def check_events(ai_settings, screen, stats, sb, play_button, ship, aliens, bullets):
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
        elif event.type == pygame.KEYDOWN:
            check_keydown_events(event, ai_settings, screen, ship, bullets)
        elif event.type == pygame.KEYUP:
            check_keyup_events(event, ship)
        elif event.type == pygame.MOUSEBUTTONDOWN:
            mouse_x, mouse_y = pygame.mouse.get_pos()
            check_play_button(ai_settings, screen, stats, sb, play_button, ship, aliens, bullets, mouse_x, mouse_y)
__init__.py 文件源码 项目:Tuxemon-Server 作者: Tuxemon 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def process_event(self, event):
        # NOTE: getattr on pygame is a little dangerous. We should sanitize input.
        if self.button and event.type == pygame.KEYUP and event.key == getattr(pygame, self.button):
            self.state = "running"
            self.button = None
            return None

        return event
tools.py 文件源码 项目:tensorflow_dqn_supermario 作者: JSDanielPark 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def event_loop(self, key):
        if key != None and self.keys != key:
            self.keys = key

        else:
            for event in pg.event.get():
                if event.type == pg.QUIT:
                    self.done = True
                elif event.type == pg.KEYDOWN:
                    self.keys = pg.key.get_pressed()
                    self.toggle_show_fps(event.key)
                elif event.type == pg.KEYUP:
                    self.keys = pg.key.get_pressed()
                self.state.get_event(event)
client.py 文件源码 项目:ice-mud-game 作者: PyBargain 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def handle_key(self, time):
        """
        ??????
        """
        for event in pygame.event.get():
            if event.type == pygame.KEYUP and event.key == pygame.K_ESCAPE: self.stop()
        self.state_changed = self.key_binding.update(lambda key: pygame.key.get_pressed()[key], time, self)
gamestates.py 文件源码 项目:neuroblast 作者: ActiveState 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def update(self,screen,event_queue,dt,clock, joystick, netmodel, vizmodel):
        nextState = self        
        self.name = gameover.enter_text(event_queue,screen, 8)
        for event in event_queue:
            if event.type == pygame.KEYUP:
                if event.key == pygame.K_RETURN:
                    self.name = gameover.pressed
                    leaderboard.StoreScore(self.name,self.score)
                    nextState = Leaderboard(self.name)                    
        return nextState
WordTranslations.py 文件源码 项目:python-kinect 作者: jgerschler 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def run(self):
        self.score = 0
        while not self.finished:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    self.finished = True
                if event.type == pygame.KEYUP and event.key == pygame.K_SPACE:
                    self.start_ticks = pygame.time.get_ticks()
                    self.new_round()

        self._kinect.close()
        pygame.quit()
SentenceBuilder.py 文件源码 项目:python-kinect 作者: jgerschler 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def run(self):
        self.score = 0
        while not self.finished:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    self.finished = True
                if event.type == pygame.KEYUP and event.key == pygame.K_SPACE:
                    self.start_ticks = pygame.time.get_ticks()
                    self.new_round()

        self._kinect.close()
        pygame.quit()


问题


面经


文章

微信
公众号

扫码关注公众号