Nuitka/Nuitka

Creating an exe that uses Flet with a custom icon only changes the binary icon, not the app itself

Open

#2 909 ouverte le 8 juin 2024

Voir sur GitHub
 (38 commentaires) (0 réactions) (1 assigné)Python (565 forks)batch import
enhancementhelp wanted

Métriques du dépôt

Stars
 (10 351 stars)
Métriques de merge PR
 (Merge moyen 5j 12h) (6 PRs mergées en 30 j)

Description

  • Nuitka version, full Python version, flavor, OS, etc. as output by this exact command.

2.3 Commercial: None Python: 3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] Flavor: CPython Official Executable: C:\Users\abdul\AppData\Local\Programs\Python\Python312\python.exe OS: Windows Arch: x86_64 WindowsRelease: 11 Version C compiler: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64\cl.exe (cl 14.3).

  • How did you install Nuitka and Python

I used pip install nuitka

  • Also supply a Short, Self Contained, Correct, Example Make a python file, use flet, pip install flet. Use this demo code:
import flet
from flet import IconButton, Page, Row, TextField, icons

def main(page: Page):
    page.title = "Flet counter example"
    page.vertical_alignment = "center"

    txt_number = TextField(value="0", text_align="right", width=100)

    def minus_click(e):
        txt_number.value = str(int(txt_number.value) - 1)
        page.update()

    def plus_click(e):
        txt_number.value = str(int(txt_number.value) + 1)
        page.update()

    page.add(
        Row(
            [
                IconButton(icons.REMOVE, on_click=minus_click),
                txt_number,
                IconButton(icons.ADD, on_click=plus_click),
            ],
            alignment="center",
        )
    )

flet.app(target=main)

Compile it to exe with Nuitka, specify an icon, the icon will be used, but when u open the app, youll see the flet icon used instead. This behavior isnt present when using pyinstaller, so it is not a problem with flet itself.

  • Provide in your issue the Nuitka options used

This is my command: nuitka --windows-console-mode=disable --mingw64 --onefile --windows-icon-from-ico=C:/Users/abdul/OneDrive/Desktop/main/code/Python/important/Necrotic/assets/icon.ico --output-dir=exeified/ main.py

Guide contributeur