ronaldoussoren / py2app

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.
Other
343 stars 36 forks source link

py2app covers GUI in black on python 3.8 #421

Open 0xFpf opened 2 years ago

0xFpf commented 2 years ago

Hi, I used py2app 0.27 with python 3.8.5 on an Intel based Monterey 12.1. The app appears all black but the Tkinter GUI behind it works (when I click where a button is supposed to be it works, the GUI is simply covered by a black screen). Tkinter version is 8.6 when running the app, maybe it's an issue? There are no errors on the console and it works fine on VScode. Do you recognise this kind of error? Kindly let me know.

ronaldoussoren commented 2 years ago

How did you install Python (python.org installer, homebrew, ...)? If using the Python.org installer: which variant (there are two variants, one of which includes native support for Apple Silicon)

The description is similar to #374, but that was fixed in an earlier release.

FWIW: I don't see this problem with Python 3.10 using the python.org installer. Likewise with the 3.8 "x86_64" installer on python.org (which AFAIK would have resulted in a black window before #374 got fixed)

0xFpf commented 2 years ago

I installed two pythons, the first was 3.8.9 and then upon finding out that it didn't support certain packages I needed I also installed 3.8.5, and selected that as my main interpreter on vscode, also when installing packages they all install on this 3.8.5. Both versions are installed from python.org and are 64 bit.

I don't know about the two variants, because there was only one installer for Mac so I used that one: https://www.python.org/downloads/release/python-385/

Could it be that py2app is confusing python versions? I don't know how to uninstall 3.8.9 but I don't use it, and none of my packages are installed there (frankly I don't even remember how I managed to set 3.8.5 as global) so if it did use 3.8.9 it wouldn't allow my app run at all (which isn't the case)..

ronaldoussoren commented 2 years ago

@FPFdeveloper : Very odd. I cannot reproduce this in a VM running Monterey 12.3, Python 3.8.8 and pyobjc 0.28 (upcoming release). Python was installed using the installer on python.org that does not have support for arm64 (Apple Silicon).

About python installations:

Only that last 3.8 release with an installer (3.8.10) has two variants, your using older versions that do not have native support for arm64. That's not really important though, I asked about the variant because the two have different builds of the Tk library that affect how py2app has to treat them.

Do you have Xcode or the Xcode Command Line tools installed? If you have /usr/bin/python3 is an installation of Python 3.8 that's part of that toolset.

The 3.8.5 and 3.8.9 installers on www.python.org install into the same prefix, that is your installation of 3.8.5 erased the earlier installation of 3.8.9, which means you have to do nothing to remove that earlier version. Both installers install Python in a location that is not in the default shell search path, but do update your shell profile. That update is only active after creating a new Terminal window. That may explain why the 3.8.9 wasn't visible at first.

0xFpf commented 2 years ago

Just tried on someone else's Mac, Big Sur 11.1, fresh python.org install of 3.8.8. Then installed py2app using 'pip3 install py2app'. To be safe I even simplified my code leaving just a simple GUI with a few simple methods and a few .png dependencies (added them to the setup file). When I ran 'python setup.py py2app -A' I got errno1 operation not permitted. So I ran 'python3 setup.py py2app -A', all good in the terminal, and I got no errors when running the app, but the app is still covered in black. (Let me know if 'python3' is perhaps not how its supposed to be done).

0xFpf commented 2 years ago

Update: I downgraded to 0.25 (whilst on python 3.8.5) and it works. Not sure why, in any case thank you for your help. Let me know if I should close this thread or not.