I'm currently working on a personal project. I was planning to create a Secured Database where only people with Special ID's are able to access by just swiping their IDs on the scanner to be able to enter. The problem is that whenever the IDs do get read, they don't automatically return the input from the Entry box. Here's my code as reference to what i'm talking about:
Entry1 = Entry(main, width = 20)
Entry1.pack()
lbl = Label(main, text = "a")
lbl.pack()
lb2 = Label(main, text = "a")
lb2.pack()
lb3 = Label(main, text = "a")
lb3.pack()
def find():
with open(CsvFile, newline = '') as csvcsv:
reader = csv.DictReader(csvcsv)
barcode = Entry1.get()
for row in reader:
if barcode == row['Sample']:
lbl.config(text = row[''])
lb2.config(text = row[''])
break
else:
lbl.config(text='Your not a registered User')
keyboard.on_press_key("ENTER", lambda _:find)
Button(main, text='search', command = find).place(x=100, y=170)
main.mainloop()
This just a sample code but if anyone has an answer, It's appreciated...
CodePudding user response:
The problem is that whenever the IDs do get read, they don't automatically return the input from the Entry box.
One possible solution to this problem is to use the .get() method on the Entry widget to retrieve the text inputted by the user.