From 595bc7f6786f4ff0a314ac6cc7b703cdc63dddce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B3=A0=EC=84=9C=EC=98=A8?= Date: Thu, 27 Jun 2024 19:16:35 +0900 Subject: [PATCH] [style] code style changed --- functions.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/functions.py b/functions.py index d4c546f..77a267a 100644 --- a/functions.py +++ b/functions.py @@ -105,13 +105,22 @@ def generate_map(PATH): def distance(RECT1, RECT2): return math.sqrt((RECT1.centerx - RECT2.centerx) ** 2 + (RECT1.centery - RECT2.centery) ** 2) +INTERVALS = [] +INTERVAL_IDX = 0 + # 매 초 마다 실행 def set_interval(CALLBACK, SEC, PARAM=None): - def func_wrapper(): - set_interval(CALLBACK, SEC, PARAM) + global INTERVAL_IDX + + def func_wrapper(INTERVAL_IDX): + INTERVALS[INTERVAL_IDX] = set_interval(CALLBACK, SEC, PARAM) if PARAM: CALLBACK(PARAM) else: CALLBACK() - timer = Timer(SEC, func_wrapper) + timer = Timer(SEC, func_wrapper, (INTERVAL_IDX,)) timer.start() + + INTERVALS.append(timer) + INTERVAL_IDX += 1 + return timer \ No newline at end of file