Fix fullscreen mode and icon button clickability #11

Merged
Copilot merged 2 commits from copilot/fix-pil-module-loading-issue into main 2025-11-15 22:03:25 -06:00
Copilot commented 2025-11-15 21:44:56 -06:00 (Migrated from github.com)

Application didn't launch in fullscreen mode and icon buttons were unclickable in fullscreen due to incorrect tkinter Button sizing.

Changes

  • Fullscreen initialization: Replace fixed 800x600 geometry with -fullscreen attribute, add Escape key binding to exit
  • Icon button sizing: Remove width/height parameters from image buttons (they specify pixels, not button size, interfering with click detection). Keep dimensions only for text-fallback buttons
  • Icon visibility: Increase image size 80x80 → 120x120 for fullscreen readability

Root Cause

tkinter Button dimensions work differently for text vs images:

  • Text buttons: width/height = character count
  • Image buttons: width/height = pixel constraints that conflict with image rendering
# Before: Fixed dimensions broke image button clicking
button = tk.Button(image=icon, width=120, height=120)

# After: Conditional sizing based on content type
button_config = {...}
if not icon_image:
    button_config['width'] = 20  # characters for text
    button_config['height'] = 6
button = tk.Button(**button_config)

PIL/Pillow import already had proper error handling; just needs pip install -r requirements.txt.

Original prompt

The Python PIL Module is not loading properly, and icons cannot be clicked when in full screen mode. Can we ensure that images load and that the application opens with a full screen when ran


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Application didn't launch in fullscreen mode and icon buttons were unclickable in fullscreen due to incorrect tkinter Button sizing. ## Changes - **Fullscreen initialization**: Replace fixed 800x600 geometry with `-fullscreen` attribute, add Escape key binding to exit - **Icon button sizing**: Remove `width`/`height` parameters from image buttons (they specify pixels, not button size, interfering with click detection). Keep dimensions only for text-fallback buttons - **Icon visibility**: Increase image size 80x80 → 120x120 for fullscreen readability ## Root Cause tkinter Button dimensions work differently for text vs images: - Text buttons: `width`/`height` = character count - Image buttons: `width`/`height` = pixel constraints that conflict with image rendering ```python # Before: Fixed dimensions broke image button clicking button = tk.Button(image=icon, width=120, height=120) # After: Conditional sizing based on content type button_config = {...} if not icon_image: button_config['width'] = 20 # characters for text button_config['height'] = 6 button = tk.Button(**button_config) ``` PIL/Pillow import already had proper error handling; just needs `pip install -r requirements.txt`. <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > The Python PIL Module is not loading properly, and icons cannot be clicked when in full screen mode. Can we ensure that images load and that the application opens with a full screen when ran </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
SluberskiHomeLab (Migrated from github.com) reviewed 2025-11-15 21:44:56 -06:00
Sign in to join this conversation.
No description provided.