Hi. I make my first steps on programming and i try to learn Python and Tkinter. I want to make a simple calc that has 2 entries and when i press the sum button make the sum and print the result on a label. The problem is that i get this error:
Quote:AttributeError: 'NoneType' object has no attribute 'get'What i do wrong?
1 2 3 4 5 6 7 8 9 10 11 12 13 |
from tkinter import * root = Tk() def sum (): result = Label (root, text = int (entry1.get()) + int (entry2.get())).pack() entry1 = Entry(root).pack() entry2 = Entry(root).pack() sumbutton = Button (root, text = "+" , command = sum ).pack() root.mainloop() |