Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #+++++++ FIRST OF ALL +++++++++++
- #Download cx_Freeze and install, and then, follow this tutorial
- #create a folder in Python directory folder named mycodes
- #save this two codes inside
- #toexe.py
- #++++++++++++++++++++
- import sys
- from cx_Freeze import setup, Executable
- # Dependencies are automatically detected, but it might need fine tuning.
- build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}
- # GUI applications require a different base on Windows (the default is for a
- # console application).
- base = None
- if sys.platform == "win32":
- base = "console" #if you want to make a Windows GUI use "Win32Gui" but don't use console functions!
- setup( name = "WeakDay",
- version = "0.1",
- description = "My Console application!",
- options = {"build_exe": build_exe_options},
- executables = [Executable("mycodes/weak.py", base=base)])
- #++++++++++++++++++++
- #weak.py
- #++++++++++++++++++++
- import sys
- days = ["monday","tuesday","wednesday","thursday","friday","saturday","sunday"]
- def weakday( day_s) :
- if int(day_s) in range(1,7) :
- print(days[int(day_s)-1])
- else :
- print("Enter a valid day of the week!")
- day = input('Enter the day of the week: ')
- weakday(day)
- return;
- day = input('Enter the day of the week: ')
- weakday(day)
- #++++++++++++++++++++
- #and now, open the a command line, go to python directory folder (something like [ cd "C:\Python33" ])
- #and execute the command "python mycodes/toexe.py build"
- #back to python directory folder, then build folder, then exe.win32-3.3 folder, and execute the file named weak.exe
- #done
Add Comment
Please, Sign In to add comment