I am trying to take entry from an entry boxes and use them in an equation. Basically it is
Entry_one - Entry_two * entry_three / 12. But I cant seem to figure out how to do this. To make it more clear here is the working python code:
a = int(input('Order Amount. '))
c = int(input('Beams Left. '))
l = int(input('Beam Length. '))
a1 = a-c
a2 = a1*l
a3 = a2/12
print ('The Hourly Count Is: ',a3)
Now here is the code that I'm trying to make do the exact same thing with tkinter:
from tkinter import *
root = Tk()
root.geometry('450x450')
root.title('Hourly Production Count')
def calc_result():
subtract_var = int(total_order_ent.get()) - int(beams_left_ent.get())
beams_left_var = int(subtract_var) * int(length_ent.get())
order_output = int(beams_left_var) / 12
answer_var = order_output.get()
label = Label(root,text = answer_var).pack()
button1 = Button(root,text = 'Enter',command = calc_result,fg='black',bg= 'green').pack()
total_order_ent = Entry(root).pack()
Beams_left_ent = Entry(root).pack()
length_ent = Entry(root).pack()
label_total = Label(root,text = 'Enter Total Order Amount').pack()
label_beams_left = Label(root,text = 'Enter Amount Left To Complete').pack()
root.mainloop()
That's what I have so far. I havn't used any grid placement for the widgets yet since I just want to get the code to work before I work on how it looks but if anyone can help me it would be appreciated. I've searched other questions and have modified other code, tried it as a class and other things and just cant seem to make it work. some errors I'm getting are:
line 23, in <module>
label_length = Label('Enter Beam Length').pack()
Python\Python35\lib\tkinter\__init__.py", line 2109, in _setup
self.tk = master.tk
AttributeError: 'str' object has no attribute 'tk'