From 3c84622d6d13d6d65dbaf47524cf1cfe2569a045 Mon Sep 17 00:00:00 2001 From: kirbylife Date: Tue, 3 Dec 2019 03:24:36 -0600 Subject: [PATCH] added menu to the icon system tray --- client.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client.py b/client.py index 3b9201a..6428500 100755 --- a/client.py +++ b/client.py @@ -12,8 +12,9 @@ from shutil import rmtree from threading import Thread from time import sleep -import pystray from PIL import Image, ImageTk +from pystray import Icon, Menu +from pystray import MenuItem as Item from requests import post from websocket import WebSocket @@ -27,7 +28,7 @@ _offline_icon = Image.open("img/icons/offline.png") _standby_icon = Image.open("img/icons/offline.png") -class MunyalClient(pystray.Icon): +class MunyalClient(Icon): def __init__(self): super(MunyalClient, self).__init__("Munyal") self.icon = _standby_icon @@ -49,8 +50,9 @@ class MunyalClient(pystray.Icon): name="downloader", daemon=True) thread_uploader.start() - # thread_downloader.start() + thread_downloader.start() self.run(self.__run) + self.menu = Menu(Item("Exit", lambda *args: sys.exit(0))) def __run(self, icon): icon.visible = True