예제 #1
0
 def stop(self):
     if(self.bot_thread is not None):
         stop_thread(self.bot_thread)
         self.bot_thread = None
         self.task_title.config(text='Task: None')
         self.task_text.delete(1.0, END)
         self.bot = None
예제 #2
0
def refresh():
    global MAZE, ENTRANCE, EXIT, SOLVE_THREAD
    if SOLVE_THREAD is not None and SOLVE_THREAD.is_alive():
        stop_thread(SOLVE_THREAD)
        SOLVE_THREAD = None
    # 生成迷宫与入口
    size = random_maze_size()
    MAZE, ENTRANCE, EXIT = generate_maze(size, size)
    SOLVE_THREAD = threading.Thread(target=solve_maze,
                                    args=(MAZE, ENTRANCE, EXIT, draw_maze))
    SOLVE_THREAD.start()
예제 #3
0
 def stop(self):
     if self.curr_thread is not None:
         stop_thread(self.curr_thread)
         self.curr_thread = None
         return True
     return False
예제 #4
0
        x, y, length, height = button['x'], button['y'], button[
            'length'], button['height']
        pos_x, pos_y = pos
        if x <= pos_x <= x + length and y <= pos_y <= y + height:
            button['click']()


def random_maze_size():
    return random.randint(5, 20) * 2 + 1


if __name__ == '__main__':
    # 生成迷宫与入口
    size = random_maze_size()
    MAZE, ENTRANCE, EXIT = generate_maze(size, size)
    SOLVE_THREAD = threading.Thread(target=solve_maze,
                                    args=(MAZE, ENTRANCE, EXIT, draw_maze))
    SOLVE_THREAD.start()
    while True:
        CLOCK.tick(FPS)
        for event in pygame.event.get():
            # 检查是否关闭窗口
            if event.type == pygame.QUIT:
                if SOLVE_THREAD is not None and SOLVE_THREAD.is_alive():
                    stop_thread(SOLVE_THREAD)
                    SOLVE_THREAD = None
                exit(0)
            elif event.type == pygame.MOUSEBUTTONDOWN:
                mouse_pos = pygame.mouse.get_pos()
                dispatcher_click(mouse_pos)
예제 #5
0
파일: FtpServer.py 프로젝트: Lajizz/Ftp
def makeclose():
    utils.stop_thread(fun.threads[fun.num_th])
    setstatus(ui, False, True)
    fun.num_th += 1
    print("ftp_server close up")
예제 #6
0
파일: simple.py 프로젝트: Lajizz/Ftp
def makeclose(thread_ftp, ui):
    utils.stop_thread(thread_ftp)
    thread_ftp.sleep()
    setstatus(ui, False, True)
    print("ftp_server close up")