Oct-13-2023, 04:26 PM
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:
'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.