I got a bit of a noob question.
I want to add the floats from the 3 entries, so the total float is shown in the label.
My solution is this and I can't get it to work, what I'm doing wrong?
Thx in advance..
from tkinter import *
class App(Frame):
def __init__(self, root=None):
Frame.__init__(self, root)
self.var = DoubleVar()
self.var.set(float(0.00))
self.var2 = DoubleVar()
self.var2.set(float(0.00))
self.var3 = DoubleVar()
self.var3.set(float(0.00))
self.entry1 = Entry(root, textvariable=self.var)
self.entry1.grid(row=2, column=1)
self.entry2 = Entry(root, textvariable=self.var2)
self.entry2.grid(row=3, column=1)
self.entry3 = Entry(root, textvariable=self.var3)
self.entry3.grid(row=4, column=1)
self.total = DoubleVar()
self.total.set(float(0.00))
self.totalSum = Label(root, textvariable=self.total, relief='sunken')
self.totalSum.grid(row=5, column=1)
def totalSum(self):
self.total.set(self.var.get() + self.var2.get() + self.var3.get())
root = Tk()
app = App(root)
root.title("help")
root.mainloop()