hi
i wrote a Gui program in python3.2. i want to convert my .py program into a windows executable file(.exe).
i googled for it and found py2exe but it only supports 2.7 . is there anyway i can convert my program.

Recommended Answers

All 5 Replies

Use cx_Freeze
You should also set up Environment Variables to point to Python32.
http://www.daniweb.com/software-development/python/threads/359605/python-not-recognized
This mean that you can type python in any path in cmd(windows command line) and Python will start.

'''
my_cx_freeze.py
To run code from cmd
python my_cx_freeze.py build
Eksp from cmd:
C:\Python32\Scripts>python my_cx_freeze.py build
'''
from cx_Freeze import setup,Executable

includes = []
excludes = []
packages = []

filename = "your_code.py"
setup(
    name = 'Myapp',
    version = '0.1',
    description = 'Gui test',
    author = 'no',
    author_email = 'someting@my.org',
    options = {'build_exe': {'excludes':excludes,'packages':packages,'includes':includes}},
    executables = [Executable(filename, base = "Win32GUI", icon = None)])
commented: thanks it worked +0

Which GUI toolkit did you use?

If you use Tkinter, you can do this ...

"""
tk_setup2.exe

Using cx_Freeze with Python32 to package a Tkinter GUI toolkit
program to an executable file (.exe in Windows OS).  Module
cx_Freeze also is available for Unix systems.

Put this setup program and your Tkinter program file into the same
directory.  Change the filename in this setup program and also edit
name, version and description in setup() if you so desire.

A directory 'build' is created with a subdirectory 'exe.win32-3.2'
containing all the files needed for distribution including the
.exe file named after the Tkinter program file.

The total distribution has a size of about 13.5 MB

The Python32 version works much better now with tkinter code.

I used:
http://cx-freeze.sourceforge.net/
cx_Freeze-4.2.3.win32-py3.2.msi
"""

import sys
from cx_Freeze import setup, Executable

sys.argv.append("build")  # replaces commandline arg 'build'

# change the filename to your program file
filename = "tk_calculator2.py"

base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(
    name = "Calculator2",
    version = "1.0",
    description = "cx_Freeze Tkinter script",
    executables = [Executable(filename, base=base)])

@vegaseat i used tkinter

Tkinter should work nicely. It's PySide that gives lots of problems with cx_Freeze.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.