Python Forum
[Tkinter] compare entry with value inside file - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [Tkinter] compare entry with value inside file (/thread-34026.html)



compare entry with value inside file - rwahdan - Jun-18-2021

Hi,

I have a tkinter entry and I will get a number from user as string since I am using entry. Then I am checking a file entry that has a number which is considered as string as well (from my basic understating). I need to compare them and check if same or not.

entry = Entry(session_start)
entry.config(show="*")
entry.grid(row=8,column=1)

#entry is from user and thenum is from file
if entry == thenum:
    complete_purchase()
  else:
    Label(session_start, text= "not same!").grid(row=11,column =0)
Then I read a line from a file that
has the number I want to check against

so for example in the entry I put 123
in the file the number is 123

how to check that if they are the same or not.

Thanks


RE: compare entry with value inside file - Yoriz - Jun-19-2021

entry.get()
to use the method to get the value from the entry, by only using entry it is a pointer to the actual entry itself.