Python Forum
AttributeError: 'NoneType' object has no attribute 'get'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AttributeError: 'NoneType' object has no attribute 'get'
#1
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?

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()
Reply


Messages In This Thread
AttributeError: 'NoneType' object has no attribute 'get' - by George87 - Dec-22-2021, 08:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  'NoneType' object has no attribute 'get' zunebuggy 8 1,544 Oct-13-2023, 06:39 PM
Last Post: zunebuggy
  tkinter AttributeError: 'GUI' object has no attribute pfdjhfuys 3 1,673 May-18-2023, 03:30 PM
Last Post: pfdjhfuys
  [Kivy] Windows 10: AttributeError: 'WM_PenProvider' object has no attribute 'hwnd' mikepy 1 2,412 Feb-20-2023, 09:26 PM
Last Post: deanhystad
  [Tkinter] Can't update label in new tk window, object has no attribute tompranks 3 3,670 Aug-30-2022, 08:44 AM
Last Post: tompranks
  [PyQt] AttributeError: 'NoneType' object has no attribute 'text' speedev 9 11,605 Sep-25-2021, 06:14 PM
Last Post: Axel_Erfurt
  [Tkinter] AttributeError: '' object has no attribute 'tk' Maryan 2 14,858 Oct-29-2020, 11:57 PM
Last Post: Maryan
  [Tkinter] AttributeError: 'tuple' object has no attribute 'replace' linuxhacker 7 6,967 Aug-08-2020, 12:47 AM
Last Post: linuxhacker
  [Kivy] AttributeError: 'NoneType' object has no attribute 'bind' faszination_92 2 6,354 Apr-12-2020, 07:01 PM
Last Post: Larz60+
  AttributeError: '_tkinter.tkapp' object has no attribute 'place_forget' edphilpot 5 9,295 Dec-20-2019, 09:52 PM
Last Post: joe_momma
  [Tkinter] AttributeError: 'App' object has no attribute 'set_text' Sahil1313 6 12,185 Jun-17-2018, 05:01 AM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020