Hanzalah Ravat
Hanzalah Ravat

Reputation: 43

How To add icons to exe using Cx_Freeeze

I havs the setup.py file which is used to build my program. I wanted to know how to add an icon to the final exe

import sys
from cx_Freeze import setup, Executable

setup(
name = "Calculator",
version = "3.7.8",
description = "Simple Calculator",
executables = [Executable("Calculator.py", base = "Win32GUI")])

Upvotes: 0

Views: 1483

Answers (1)

Texom512
Texom512

Reputation: 4863

Just add icon=icon.ico in Executable() like this:

from cx_Freeze import setup, Executable

target = Executable(
    script="Calculator.py",
    base="Win32GUI",
    compress=False,
    copyDependentFiles=True,
    appendScriptToExe=True,
    appendScriptToLibrary=False,
    icon="icon.ico"
    )

setup(
    name="Calculator",
    version="3.7.8",
    description="Simple Calculator",
    author="Hanzalah Ravat",
    options={"build_exe": options},
    executables=[target]
    )

Upvotes: 2

Related Questions