Python Forum
[cx_Freeze] Build .exe they get more .py files, help needed !
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[cx_Freeze] Build .exe they get more .py files, help needed !
#4
You call the one file that start the game.
As it's package all work together and other files are imported into start_game.py.

Example Pyinstaller:
I add one line so console window don't disappear.
In a game or GUI there is main loop that run all time until exit.
For console it's not like that.
input('Press enter to exit')
In my_game folder i run:
(cx) C:\1\cx\my_game
λ pyinstaller --onefile start_game.py
There will be one start_game.exe in dist folder.


cx_Freeze example.
I change to base = 'Console' and call start_game.py.
#cx_run.py
from cx_Freeze import setup,Executable
import sys

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

# If need to include/exclude module/packages
includes =
excludes =
packages =

# Console or Win32GUI
base = None
if sys.platform == "win32":
    base = 'Console'
    #base = 'Win32GUI'


# Name of file to make ".exe" of
filename = "start_game.py"
setup(
    name = 'Myapp',
    version = '0.1',
    description = 'Cx test',
    options = {'build_exe': {'excludes':excludes,'packages':packages,'includes':includes}},
    executables = [Executable(filename, base=base, icon=None)])

#--|  From command line
#python cx_run.py build
From command line:
(cx) C:\1\cx\my_game
λ python cx_run.py build
For more on building stuff for Python like Wheel and use PyPi.
Look at my tutorial here.
Reply


Messages In This Thread
RE: [cx_Freeze] Build .exe they get more .py files, help needed ! - by snippsat - Oct-02-2017, 10:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Failed tkinter Compile In Custom 3.7.2 Build Using Custom Tcl/Tk Build gwc 0 2,628 Jan-25-2019, 01:56 PM
Last Post: gwc
  [cx_Freeze] CMD Prompt can't find my setup.py, help needed ! JamieVanCadsand 1 3,815 Sep-30-2017, 10:10 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020