I am currently using Canopy to run my code. I was trying to fetch some integer data from the entry box in my GUI according to the number that I give in the for
loop and print it. It is not working.
Here is the error:
Traceback (most recent call last):
File "C:\Program Files\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win- x86_64\lib\lib-tk\Tkinter.py", line 1532, in __call__
return self.func(*args)
File "C:\Users\SIMULATOR\Desktop\python\life cycle graph\try4.py", line 24, in const
z=int(s)
ValueError: invalid literal for int() with base 10: ''
My code is:
from Tkinter import *
root = Tk()
root.geometry('1000x600+400+400')
def const():
const_entries = []
for i in range(0, 4):
en = Entry(root)
en.pack()
en.place(x=50, y = 200 + 25*i)
s = en.get()
z = int(s)
const_entries.append(z)
j = i + 1
label = Label(root, text="Alternative %r"%j)
label.pack()
label.place(x = 200, y = 200 + 25*i)
print const_entries
button1 = Button(root, text="Construction cost", command = const).grid(row = 15, column = 0)
root.mainloop()