I created a program in python through Anaconda (Spyder, more exactly) and made an .exe out of it with pyinstaller. Simply put, when I run it through the anaconda prompt it works, but when I double click it, it simply waits for a few seconds and then closes, without doing anything.
The code:
import xlrd
from scipy.fft import fft
import numpy as np
import tkinter as tk
def main():
root =tk.Tk()
root.title("Data input window")
canvas1 = tk.Canvas(root, width = 620, height = 210, relief = 'raised')
canvas1.pack()
inputdata = tk.StringVar(root)
def getvalue():
loc = inputdata.get()
run(loc)
label1 = tk.Label(root, text='Copy file and paste here:')
label1.config(font=('helvetica', 14))
canvas1.create_window(310, 25, window=label1)
e1 = tk.Entry(root,textvariable = inputdata, width=100,fg="blue",bd=3,selectbackground='violet')
canvas1.create_window(310, 65, window=e1)
label2 = tk.Label(root, text='Only .xls files supported')
label2.config(font=('helvetica', 8))
canvas1.create_window(310, 105, window=label2)
button1 = tk.Button(root, text='Input data', fg='White', bg= 'dark green', height = 1, width = 10,command=getvalue)
canvas1.create_window(310, 180, window=button1)
root.mainloop()
s = input('Press X to exit')
return 0;
if __name__ == '__main__':
main()
run(loc) is basically the entire program that needs to run when I press a certain button on the tkinter widget that appears at start. Even if I require an input for the program to close, it still closes automatically and no tkinter widget appears.
I am a beginner, so sorry if this issue is a simple one.