pip install wxPython
pip install PySimpleGUIWx
test_tray_icon.py
貼入下列內容並存檔:import PySimpleGUIWx as sg
ico_file="C:\\demo\\doc-icon.ico"
tray = sg.SystemTray(menu= ['menu',['Open', ['&Save::KEY', '---', 'Issues', '!Disabled'], 'E&xit']],filename=ico_file)
tray.ShowMessage('My Message', 'The tray icon is up and runnning!')
while True:
event = tray.Read()
print(event)
if event == 'Exit':
break
ico的檔案路徑請自行修改
test_tray_icon.py
查看工作列右下角就會看到常駐的小圖示出現了。python test_tray_icon.py
再按[Enter]