Найти - Пользователи
Полная версия: закрыть программу
Начало » Python для новичков » закрыть программу
1
Genabox
есть модуль tray
 import pystray
from PIL import Image
import sys
#import startbot
#sys.path.insert(2, sys.path[0]+'\\images')
image = Image.open("images\icon.png")
 
def trays():
    def after_click(icon, query):
        if str(query) == "GeeksforGeeks Website":
            print("The Best Place to learn anything Tech \
        Related -> https://www.geeksforgeeks.org/")
            # icon.stop()
        elif str(query) == "GeeksforGeeks Youtube":
            print("Youtube Channel of GeeksforGeeks \
        is -> https://www.youtube.com/@GeeksforGeeksVideos")
            # icon.stop()
        elif str(query) == "GeeksforGeeks LinkedIn":
            print("LinkedIn of GeeksforGeeks \
        is -> https://www.linkedin.com/company/geeksforgeeks/")
        elif str(query) == "testt":
            print("test")
        elif str(query) == "Exit":
            icon.stop()
            startbot.threadVIUCE.stop()
            startbot.sys.exit()
    icon = pystray.Icon("GFG", image, "GeeksforGeeks",
                        menu=pystray.Menu(
        pystray.MenuItem("GeeksforGeeks Website",
                        after_click),
        pystray.MenuItem("GeeksforGeeks Youtube",
                        after_click),
        pystray.MenuItem("GeeksforGeeks Youtube",
                        after_click),
        pystray.MenuItem("GeeksforGeeks LinkedIn",
                        after_click),
        pystray.MenuItem("testt",
                        after_click),
        pystray.MenuItem("Exit", after_click)))
    icon.run()

          startbot.threadVIUCE.stop()
            startbot.sys.exit()
startbot - это основное преложение которое нужно закрыть
как это сделать?
Genabox
и как обратится к функции из startbot из модуля tray?
 (startbot.some_definition())
потому что при его импорте в модуль он пишет о циклическом импортированиии
потому что в startbot был импортирован tray (этот модуль)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB