小编nos*_*one的帖子

更改 pystray 托盘通知标题

我在寻找更改pystray托盘通知标题的方法时遇到问题。看起来它从某个地方获取了默认值“Python”。见下图:

图像

文档中,没有额外的参数来更改通知图标标题。如何找到一种方法将标题值更改为我想要的值?

这是一个工作代码示例:

from tkinter import *

from pystray import MenuItem as item
from PIL import Image, ImageTk

from res import * #here is my base64 encoded icon. Variable icon_base64.
from base64 import b64decode

import pystray
import base64

pic=ImageTk.BytesIO(icon_base64) #transfering base64 to bytes

def run_icon():
    #image = Image.open("icon.ico") #uncomment this to use a standard image, isntead of base64.
    title="Tray title"
    image=Image.open(pic) #comment this if using standard way of image
    menu = (item('test1', lambda: show(),default = True), item('Exit', …
Run Code Online (Sandbox Code Playgroud)

python python-3.x pystray

6
推荐指数
1
解决办法
1577
查看次数

标签 统计

pystray ×1

python ×1

python-3.x ×1