Python Forum
'NoneType' object has no attribute 'get'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'NoneType' object has no attribute 'get'
#1
I used to develop in VB 6 and am new to Python. I am finding it to be very powerful but a little difficult to debug at times. I am going through some very basic beginner tutorials on YouTube. I have the following "hello world" code but I am getting the error:

'NoneType' object has no attribute 'get'

Here is my Python code:

from tkinter import *

root = Tk()
root.configure(background='black')
e = Entry(root, text = "Message").grid(row=10, column = 5)
#how to make form black
# Creating a Label Widget
def myClick():
    myLabel1 = Label(root, text = "I clicked Encrypt!", bg='black', fg = 'white').grid(row=0, column=0)

def AnothClick():
    myLabel1 = Label(root, text = "" + e.get()).grid(row=0, column=0)
    
myLabel1 = Label(root, text="Hello World!", bg='black', fg = 'white').grid(row=0, column = 0)
myLabel2 = Label(root, text="My Name is Bob!", bg='black', fg = 'white').grid(row=1, column = 1)
myButton1 = Button(root, text ="Encrypt", command=myClick, fg="white", bg="black").grid(row=2, column = 1)
myButton2 = Button(root, text ="Decrypt",state = DISABLED, padx = 50).grid(row=3, column = 1)
myButton3 = Button(root, text ="Copy", command=AnothClick).grid(row=4, column=1)
# Shoving it onto the screen
# myLabel1.grid(row=0, column = 0)
# myLabel2.grid(row=1, column = 1)

root.mainloop()
From the example on YouTube, I was expecting that if I entered some text into the Entry (TextBox) and clicked the 'Copy' button, it would change Label1 to the text from the Entry box. Instead I got the above error.
Reply


Messages In This Thread
'NoneType' object has no attribute 'get' - by zunebuggy - Oct-13-2023, 04:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter AttributeError: 'GUI' object has no attribute pfdjhfuys 3 1,671 May-18-2023, 03:30 PM
Last Post: pfdjhfuys
  [Kivy] Windows 10: AttributeError: 'WM_PenProvider' object has no attribute 'hwnd' mikepy 1 2,411 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
  AttributeError: 'NoneType' object has no attribute 'get' George87 5 15,723 Dec-23-2021, 04:47 AM
Last Post: George87
  [PyQt] AttributeError: 'NoneType' object has no attribute 'text' speedev 9 11,604 Sep-25-2021, 06:14 PM
Last Post: Axel_Erfurt
  [Tkinter] AttributeError: '' object has no attribute 'tk' Maryan 2 14,857 Oct-29-2020, 11:57 PM
Last Post: Maryan
  [Tkinter] AttributeError: 'tuple' object has no attribute 'replace' linuxhacker 7 6,963 Aug-08-2020, 12:47 AM
Last Post: linuxhacker
  [Kivy] AttributeError: 'NoneType' object has no attribute 'bind' faszination_92 2 6,349 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,183 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