exe from a most simple tkinter python script not working

Viewed 80

Here is my code of a very simple python script using tkinter. I am trying to convert into an exe file to run on my windows 10 laptop but the exe is not working properly.

from tkinter import *
window = Tk()
def myfunc():
    t1.delete("1.0", "end")
    t2.delete("1.0", "end")
    t3.delete("1.0", "end")
    kg = float(mytext.get())
    gm = kg*1000
    t1.insert(END, gm)
    pound = kg*2.2
    t2.insert(END, pound)
    ounce = kg*35.2
    t3.insert(END, ounce)
mytext = StringVar()
e1 = Entry(window, textvariable=mytext)
e1.grid(row=1, column=1)
b1 = Button(window, text='Convert', command=myfunc)
b1.grid(row=1, column=3)
t1 = Text(window, height=1, width=20)
t1.grid(row=2, column=1)
t2 = Text(window, height=1, width=20)
t2.grid(row=2, column=2)
t3 = Text(window, height=1, width=20)
t3.grid(row=2, column=3)
window.mainloop()

I have already installed pyinstaller using pip. I run pyinstaller.exe --onefile .\kgconverter.py it creates a dist folder and inside it an exe file. when I double click on this exe file, nothing happens a black window opens for a fraction of second and goes away.

enter image description here

any help? I am clueless what's wrong going on?

0 Answers
Related