moses-palmer / pystray

GNU General Public License v3.0
463 stars 57 forks source link

How can I create an executable file from a python script that contains a pystray? #81

Closed w3suli closed 2 years ago

w3suli commented 3 years ago

The python script works when I run it as a .py file. Only py-stray, PIL and datetime modules are imported.

I tried pyinstaller, cx-freeze, py2exe but none generated a working executable.

The generation runs and completes the exe, but it doesn't work.

I didn't run into any problems with other tkinter, etc. scripts, but if the script contains the pystray, it will be able to generate an inoperable exe file.

This is the first time I've used pystray. So it might not be a mistake just missing some setting that I wasn’t thinking about.

I want to ask for help on how to generate a working exe file from a python script containing pystray?

moses-palmer commented 3 years ago

Thank you for your report.

Please see the documentation for pystray for an explanation and fix. This issue is a great reminder that that information should be included in this library as well.

w3suli commented 3 years ago

Thanks for the quick response.

I will review the linked description. It would be good to present a simple example with one of the better known package builders (pyinstaller, cx-freeze, py2exe).

moses-palmer commented 3 years ago

I attempted another take on dynamic backends which is available on the feature-explicit-backends branch. It supposedly removes the need to configure the packager.

Would you mind testing it?

kmchmk commented 2 years ago

Thanks for the quick response.

I will review the linked description. It would be good to present a simple example with one of the better known package builders (pyinstaller, cx-freeze, py2exe).

https://stackoverflow.com/a/68591343/6698396