From 5713422f49cf4961b5412a6f2e560ba393db3729 Mon Sep 17 00:00:00 2001 From: Thaloria Date: Wed, 26 Jul 2023 11:33:46 +0200 Subject: [PATCH] threading update --- combined_bot_main.py | 2 +- combined_user_interface.py | 1 + litris_stone_id_thread.py | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/combined_bot_main.py b/combined_bot_main.py index cf7d7e1..27e6c72 100644 --- a/combined_bot_main.py +++ b/combined_bot_main.py @@ -34,7 +34,6 @@ def run(): overlay.run_mode = 'init' continue elif overlay.run_mode == 'quit': - overlay.destroy() return else: break @@ -69,6 +68,7 @@ def run(): elif overlay.rb_int.get() == 10: ltris = Litris(overlay) ltris.execute_main_loop() + ltris.stone_id_thread.run_mode = 'stop' if __name__ == "__main__": run() diff --git a/combined_user_interface.py b/combined_user_interface.py index 924b4a9..7e52273 100644 --- a/combined_user_interface.py +++ b/combined_user_interface.py @@ -178,6 +178,7 @@ class PrimaryOverlay(threading.Thread): def destroy(self): self.hide_mining_overlay() + del self.MiningOverlay self.root.destroy() def start_button_callback(self): diff --git a/litris_stone_id_thread.py b/litris_stone_id_thread.py index 2c31d7e..a196977 100644 --- a/litris_stone_id_thread.py +++ b/litris_stone_id_thread.py @@ -30,14 +30,14 @@ class NewStoneID(threading.Thread): self.needles = {1: cv.imread("litris/blue_needle.jpg", cv.IMREAD_UNCHANGED)} - self.run_mode = 'init' + self.run_mode = 'run' self.actual_letter = "" self.to_pick_up = False self.start() def run(self): - while True: + while self.run_mode == 'run': current_stone = self.new_stone_detection() if current_stone is None: cv.waitKey(50)