[Python] How to set aplication icon in PyQt6?

Discussão em 'Python' iniciado por Stack, Fevereiro 7, 2025.

  1. Stack

    Stack Membro Participativo

    I have a small application on Python with PyQt6. Trying to set an icon with

    app.setWindowIcon(QIcon('ui\app.ico'))


    without any success. It sets window icon but the taskbar icon remains unchanged.

    I also tried adding

    import ctypes
    myappid = 'mycompany.myproduct.subproduct.version' # arbitrary string
    ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)


    from this answer, but this did not help as well.

    Also I tried png icon with no success.

    Icon size is 128x128. I am using Windows 11 23H2, Python 3.10.11, PyQt 6.7.0. Running application in Poetry 1.8.3 venv if this does matter.

    Continue reading...

Compartilhe esta Página