From 66b0a1d5626661aea602b7318aa265be64183d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Fri, 12 Aug 2022 21:28:07 +0200 Subject: [PATCH] added modules for systray icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- pc-client/main.py | 13 +++++++------ requirements.txt | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pc-client/main.py b/pc-client/main.py index b7dde55..cb55e56 100644 --- a/pc-client/main.py +++ b/pc-client/main.py @@ -1,15 +1,14 @@ import time import os current_path = os.path.dirname(os.path.realpath(__file__)) +import threading try: + import pystray + from PIL import Image, ImageDraw import serial except ImportError: - try: - os.system("pip install pyserial") - import serial - except ImportError: - print("Please execute'pip install -r requirements.txt'") - exit() + print("Please execute 'pip install -r requirements.txt'") + exit() host = serial.Serial('COM3', 9600) @@ -19,5 +18,7 @@ while True: output = output.decode("ASCII") output = output.strip() print(output) + + except KeyboardInterrupt: break \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index d0dfd58..1e6fe2a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,3 @@ +Pillow==9.2.0 pyserial==3.5 +pystray==0.19.4