Hello! While size() is working fine, I can’t get full_screen() to work and get this error message below. The problem with size() is that I can’t click on the window’s green button that would allow me to be in a true full screen mode, even if I provide the pixel height and width that correspond to my Mac’s viewport dimensions.
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'API misuse: modification of a menu's items on a non-main thread when the menu is part of the main menu. Main menu contents may only be modified from the main thread.'
*** First throw call stack:
[lots of lines here]
libc++abi: terminating due to uncaught exception of type NSException
zsh: abort
What I tested
The different sketches examples on py5’s doc. I also tried to provide a screen number, put things in settings() instead of setup()… But maybe I missed something.
import py5
x = 0
def settings():
py5.full_screen()
# py5.size(400, 200) It works fine with size
def setup():
py5.background(0)
def draw():
py5.fill(100)
py5.rect(100, 100, 20, 20)
py5.run_sketch()
Specs
Mac book pro M3 nov 2023, MacOs Sequoia 15.4.1
py5 0.10.4a2 Now 0.10.6a0
Python 3.13.3
Java JDK Temurin-21.0.7+6
Visual Studio Code 1.99.3 (Universal), with some extensions (Microsoft’s ones for Python, autopep8…). No Jupyter Notebook, files run in the integrated terminal (zsh) with a virtual environment (venv).
I can’t get your demo to run on my mac either (no VSCode):
Returns this error on my system: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow should only be instantiated on the main thread! '
As stated, size() works ok but green window button is not enabled at setup(). An alternate approach that you could use is set_resizable() to add this capability. The following works on my system using the Thonny editor:
First, I want to point out that I am currently recovering from surgery on my left arm. I can’t really type right now or do the kind of investigation that I want to do right now. However, I was able to test your example and full_screen() is working on my Mac computer.
Right now I am using Python 3.9. I did some preliminary testing with python 3.13 a week or two ago and I did find there were some issues with exceptions similar to yours that I have not yet gotten to the bottom of. I would suggest first trying a earlier version of Python. Not necessarily Python 3.9, but please try Python 3.10 or 3.11.
I am also using Java Temurin-17.0.13+11, but I doubt that is the problem here.
Also please upgrade to the latest version of py5. The latest version is 0.10.6a0, out two weeks ago. This version contains the latest processing jars.
Also, how are you running this? You mentioned VS code. Are you using VS code as an editor? Are you running the python code through the terminal? Or are you running it in a Jupyter notebook through VS code?
Just reporting full_screen() works in my PC on Garuda Linux (Arch-based distro).
Although more like a maximized window rather than an actual fullscreen.
Graphics card is an NVIDIA GeForce GTX 1660 SUPER on KDE Plasma 6.3.5 (Wayland) under Linux kernel 6.14.9-zen1-1-zen.
Hello, first of all, all the best with your recovery and thanks for testing my example code. Svan pointed an alternate approach that I’ll use for now, as I have a project to finish and present next week. Since I’m using other libraries and I’m not very familiar with working with Python, venv and so on, I’m afraid of breaking something if I try to downgrade my python version. Or to spend to much time on that.
But when my project will be over, I’ll be happy to test that. I also upgraded py5 as you suggested. Regarding VS Code, I’m using it as an editor (no Jupyter notebook). I run python files in the integrated terminal (zsh apparently) and since VS Code proposed me to do that, I’m using a virtual environment. Hope that helps.
On a mac that’s not really full screen; you can see the title bar at the top. With true full screen all you see is the canvas; depends on what interface the user wants.
Perhaps you meant ‘window’ and not ‘canvas’? The canvas is part of a window. It’s true that the Processing runtime creates windows without the resizable mask baked in; it has to be added later if the user wants it (in the objc world the user controls the mac window buttons enabled at startup). The exception in our sphere is the window created by the FX2D renderer; it comes pre-packaged with the resizable attribute and doesn’t have to be added later.
It’s not worth debating, but if the user uses set_resizable() they get the real deal on a mac, and not a ‘workaround’ (initial post indicates macos). What we should be trying to figure out is why full_screen works in Linux and not on a mac using a later python version. I’m editing my answer to call it an ‘alternate approach’ instead of a ‘workaround’.