-1

I am trying to print the tkinter entry value in python like this.

from tkinter import *
root=Tk()
root.geometry("500x500")

def temperature():
    print(celciusEntry.get())

farenheidLabel = Label(root, text = "farenheid").place(x=110, y=10)
farenheidAnswer = Label(root, text="=",).place(x=110, y=30)

celciusLabel = Label(root, text="celcuis").place(x=20, y=10)
celciusEntry = Entry(root, width=10,).place(x=20, y=30)

temperaturebtn=Button(root, height=1, text="convert temperature", command=lambda:temperature())
temperaturebtn.place(x=20,y=100)

mainloop()

But I get a error saying object has no attribute 'get' why am I getting this error.

Elias Mulderij
  • 29
  • 1
  • 1
  • 6

1 Answers1

1

Change :

...
celciusEntry = Entry(root, width=10).place(x=20, y=30)
...

to

...
celciusEntry = Entry(root, width=10)
celciusEntry.place(x=20, y=30)
...
Dharman
  • 30,962
  • 25
  • 85
  • 135