psgtray icon indicating copy to clipboard operation
psgtray copied to clipboard

Can it works on Mac OS?

Open glight2000 opened this issue 4 years ago • 6 comments

When run the sample code on mac os 11.6. I got a error:AttributeError: 'Icon' object has no attribute '_status_item'

glight2000 avatar Oct 06 '21 04:10 glight2000

Can you post the entire error message?

PySimpleGUI avatar Oct 06 '21 15:10 PySimpleGUI

Sure, Error stack here:

/Users/username/anaconda3/envs/envname/bin/python /Users/username/Documents/Projects/Geek/envname/psg_tray.py
* Error performing wm_overrideredirect while hiding the hidden master root* expected boolean value but got ""
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/Users/username/anaconda3/envs/envname/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/Users/username/anaconda3/envs/envname/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/username/anaconda3/envs/envname/lib/python3.9/site-packages/psgtray/psgtray.py", line 183, in _pystray_thread
    self.tray_icon.menu = pystray.Menu(*self.menu_items)
  File "/Users/username/anaconda3/envs/envname/lib/python3.9/site-packages/pystray/_base.py", line 141, in menu
    self.update_menu()
  File "/Users/username/anaconda3/envs/envname/lib/python3.9/site-packages/pystray/_base.py", line 216, in update_menu
    self._update_menu()
  File "/Users/username/anaconda3/envs/envname/lib/python3.9/site-packages/pystray/_darwin.py", line 81, in _update_menu
    self._status_item.setMenu_(None)
AttributeError: 'Icon' object has no attribute '_status_item'

Process finished with exit code 1

glight2000 avatar Oct 07 '21 16:10 glight2000

The System Tray feature is being supplied by a package named pystray... which reminds me that my readme certainly needs to be updated to reflect this.

You'll find that package here: https://github.com/moses-palmer/pystray

The error is definitely occurring within pystray. The docs for pystray indicate that the Mac is supported and I see from the error message that the error is happening in _darwin.py so it does appear they are at least getting to the right area in their code. It would be worth logging at Issue with them with the error trace and see if they have some ideas. Moses has been responsive in the past to my questions.

PySimpleGUI avatar Oct 07 '21 17:10 PySimpleGUI

Thanks for your research and patience. I'm trying to get help from the author of pystray.

glight2000 avatar Oct 08 '21 10:10 glight2000

I'll join in with you over there.... not going to leave you to figure it out on your own....

PySimpleGUI avatar Oct 08 '21 15:10 PySimpleGUI

That'd be great thanks :) New post here: https://github.com/moses-palmer/pystray/issues/101

glight2000 avatar Oct 09 '21 03:10 glight2000