Icons really large in toolbar in macOS Tahoe
Describe the bug
By pip-installing everything with the target option into the directory of a fresh compiled CPython on macOS Tahoe and running ./python.exe -m toga_demo we get
Steps to reproduce
See description
Expected behavior
Regular-sized icons in that place
Screenshots
No response
Environment
Python 3.13.7, macOS Tahoe latest, latest released on PyPI
Logs
No response
Additional context
The icons are actually way too wide if you expand the window to remove the dropdown. The width of the glass effect is dependent on the icon size apparently.
The optimal SWAG (scientific wild-a** guess) for a good size to keep a balance between sharpness and button width seems to be 35 and adjusting scaled resolution on my Macbook display does not seem to have impact over this value.
I suggest this diff on window.py in the Cocoa backend:
@@ -166,7 +166,7 @@
if item.tooltip:
native.setToolTip(item.tooltip)
if item.icon:
- native.setImage(item.icon._impl.native)
+ native.setImage(item.icon._impl._as_size(35))
item._impl.native.add(native)
Another thing -- if you're scrolling the scrollview on the right the scrolled away part sort of shadows into the top tool bar -- although the text sometimes flickers for some reason. Still Toga in this sense is WAY ahead of any other Python GUI toolkit -- WELL DONE Y'ALL!!!!
Oh -- the first screenshot in the additional context section is wrong [EDIT -- it isn't but it takes a lot of subtlety to see the differnece], it shall be replaced with this one:
EDIT -- another thing: once we impl native icons the _as_size(35) part should be ommitted for native icons as those already optimized their size to look good.
ANOTHER EDIT -- I'm going to make it really clear that I do not have time to work on this issue. This is probably trivial but opening a PR seriously consumes my energy which I'm running low on right now. For anyone else who wants to pull this request though, the probe at https://github.com/beeware/toga/blob/5d0c4c23b64ee9a4e4212461816c27b8a9cd55cc/cocoa/tests_backend/window.py#L116 should include a check for image size like check the size is around 25-40, and the PR should include a changenote.
If the _as_size or the impl/interface/native tri-layer structure is not too deep for first-timers to understand, feel free to apply [Good First Issue]
Thanks for the report... but this is really weird. macOS icons are deliberately multi-sized, specifically so that macOS can pick the "right" icon size for any given purpose. I'm not sure why it's picking the biggest size instead of an appropriate size.
Is the 35px size based on anything documented, or is it a guess on your part based on what looks right?
Regardless, it seems like there's a bigger project on the books to revamp how we manage icons...
@freakboy3742 Like I've mentioned, it's a SWAG. Only occurs for toolbars really. Buttons are large... but they only get so large and not larger. Below screenshot is by making star.png 100x100px
@freakboy3742 Like I've mentioned, it's a SWAG. Only occurs for toolbars really. Buttons are large... but they only get so large and not larger. Below screenshot is by making star.png 100x100px
Buttons specifically set the icon size to 32x32 as a Toga API decision, so the comparison there isn't really valid.
Some sort of system update seems to have fixed this -- closing.
EDIT -- still present... I tested with wrong Python.