Skip to content

Conversation

@paco-sevilla
Copy link
Contributor

This PR allows to set an icon using webview.start(icon=<file_path>) when the platform is WinForms (i.e. default on Windows).

This is implemented in a similar fashion as for the Qt and GTK, with the difference that we check whether _state['icon'] exists (and is a file).
This makes sure that the icon set when freezing an app can be used without having to bundle its file.
I hope this addresses the concerns raised in #1665 and #1411.

Background/Rationale: At the company where I work, we don't freeze our (internal) apps, but we deploy them to a Python Registry and install them with uv tools install. This allows us to deploy a single (pure-Python) package for both Windows and Linux users.
Even for people that freeze their apps, I think it would be nice if they could show the icon during development (on Windows).

@r0x0r
Copy link
Owner

r0x0r commented Dec 5, 2025

Fair enough, thanks for the contribution

@r0x0r r0x0r merged commit eeea4b4 into r0x0r:master Dec 5, 2025
7 checks passed
github-merge-queue bot pushed a commit to zauberzeug/nicegui that referenced this pull request Dec 8, 2025
### Motivation

There are new [releases](https://github.com/r0x0r/pywebview/releases)
for `pywebview` with nice improvements and AFAIK no breaking interfaces
to NiceGUI.

Particularly looking forward to the next release including
r0x0r/pywebview#1755, which resolves the issue
about the icon not showing on Windows discussed here:
#1745 (reply in thread)

### Implementation

Trivial change in `pyproject.toml`.
**Note:** Changing the constraint to `>=6.0,<7` might address this
comment:
[pyproject.toml#L146](https://github.com/zauberzeug/nicegui/blob/97c6b1e/pyproject.toml#L146)

### Progress

- [x] I chose a meaningful title that completes the sentence: "If
applied, this PR will..."
- [x] The implementation is complete.
- [x] Pytests have been added (or are not necessary).
- [x] Documentation has been added (or is not necessary).

---------

Co-authored-by: Paco Sevilla <[email protected]>
Co-authored-by: Falko Schindler <[email protected]>
@paco-sevilla paco-sevilla deleted the winforms-icon branch December 18, 2025 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants