Pygame sometimes fails to set icon
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 611
- Forks
- 211
- PR merge metrics
- No merged PRs in 30d
Description
Originally reported by: **Daniel Pope (Bitbucket: [lordmauve](https://bitbucket.org/lordmauve), GitHub: [lordmauve](https://github.com/lordmauve))**
----------------------------------------
Pygame Zero supports setting the icon by assigning to the `ICON` constant.
Unfortunately, this is only picked up after a window has been created. From the [Pygame documentation](https://www.pygame.org/docs/ref/display.html#pygame.display.set_icon):
> Some systems do not allow the window icon to change after it has been shown. This function can be called before pygame.display.set_mode() to create the icon before the display mode is set.
We must create a window prior to executing the module in order to support `Surface.convert_alpha()` which is used by the image loader. We might be able to statically analyse the module in order to identify values for WIDTH, HEIGHT and ICON and avoid having to change them.
----------------------------------------
- Bitbucket: https://bitbucket.org/lordmauve/pgzero/issue/65
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the module execution and image-loader paths that require Surface.convert_alpha(), then inspect where pygame.display.set_mode() and the ICON value are handled. Compare that order with pygame.display.set_icon() requirements and determine how WIDTH, HEIGHT, and ICON could be available before display creation. Done means the icon is reliably set on systems that reject changes after the window is shown, with coverage for the relevant startup behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100