0

I have a calendar build with tkcalendar and i want to make it an executable file that i can send for people to test out and give me feedback. However i cant seem to run it unless i am using python.

I tried py2exe and pyinstaller

from tkcalendar import Calendar, DateEntry
from inputs import *
from quickstart import *
from Customization import *
from importlib import reload 
try: 
    import tkinter as tk
    from tkinter import ttk
    import datetime
except ImportError:
    import Tkinter as tk
    import ttk


Button_Light = ttk.Button(root,text='Light Style', command=Main_Body_white)
Button_Dark = ttk.Button(root,text='Dark Style', command=Main_Body_Black)
enter_button2 = Button(root, text="Make-Event", command=Create)

Button_Dark.pack()
Button_Light.pack()
enter_button2.pack()

So this code works 100% but it wont open unless in python. This code grabs many different modules and combines them to create the final result

File that contains all the code for the program

I think because This code relies heavily on GUI and thats where the issue is happening.

The Gif show the problem i am having

[![enter image description here][3]][3]


enter image description here

Still no luck But this might explain better. As you can see the code does run in cmd. But it dosent RUN the GUI part

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Possible duplicate of [How to make a Python script standalone executable to run without ANY dependency?](https://stackoverflow.com/questions/5458048/how-to-make-a-python-script-standalone-executable-to-run-without-any-dependency) – Uli Sotschok Aug 22 '19 at 14:08
  • I read that but none of the options worked for me – mudhar muhi Aug 22 '19 at 14:10
  • might help: https://stackoverflow.com/questions/2933/how-can-i-create-a-directly-executable-cross-platform-gui-app-using-python – akhetos Aug 22 '19 at 14:22
  • yea i read on almost everything already. My issue is specific because i think the amount if gui i have is messing with the executing – mudhar muhi Aug 22 '19 at 14:23

2 Answers2

2

Install the module pip install auto-py-to-exe, it is working for me, after installing type auto-py-to-exe in python prompt command line auto-py-to-exe window will appear. Put input() at the end of your python script and then select your script location, do not change output folder destination, after making executable open output folder, copy or cut the .exe application and paste it anywhere outside C drive. It'll work without using python. auto-py-to-exe window image attached for your reference. enter image description here

Ashu007
  • 745
  • 1
  • 9
  • 13
0

First you need to make 1 folder and paste all files there:

Then you need to paste your folder to python directory where python install to make sure to paste in the script folder

In My case python is install on this directory:

C:\Users\Hamza Lachi\AppData\Local\Programs\Python\Python37-32\Scripts

and then type this command:

pyinstaller -w -F '.\file_name.py'

It Will Converts python file into exe file

Why Exe Can't Run:

if you link files to python file that's why your python script is not working so you need to paste that files! in exe directory

For Example:

If You Link images so if script not working so you need to copy images in exe directory

SOLUTION

Copy all files in exe directory

Hamza Lachi
  • 1,046
  • 7
  • 25