lordmauve / lordmauve/pgzero

Pygame sometimes fails to set icon

Open
#65 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug minor
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.