0

Hi I'm trying to develop a system in which I use a barcode scanner and scan membership cards and recognize who is there by ID, then my system. So only time tracking. I have PyMySQL. They works all fine but i now have TextBox with the command

...
def pause():
    barcode_input.disable()

def pause2():
   barcode_input.enabled=True

def pause_textbox():
   barcode_input.after(70,pause)
   barcode_input.after(3000, pause1)

#GUI start here
...
barcode_input.when_key_released = pause_textbox
...

and the TextBox will also turn gray. But it still takes over the data in the background if i still hold the membership card on it, but in the view it does what it should do. They takes then twice in The Table MySQL the login details. Sry for my english.

snakecharmerb
  • 47,570
  • 11
  • 100
  • 153
Daywalker
  • 1
  • 2
  • now about `enabled=False` ? – furas May 01 '21 at 04:25
  • I don't know what is the problem and I couldn't run code to test it (I don't have scanner) so I can only suggest to use `print()` to see which part of code is executed and what values you have in variable, - it is called `"print debuging"`. – furas May 01 '21 at 04:28
  • enabled=false is the same problem. TextBox ist grey but the scanner take the id and put them in my table. – Daywalker May 01 '21 at 16:58
  • then problem is in different place - where is code which get data from scanner? You have to stop this code, not button. – furas May 01 '21 at 19:40
  • here i have upload my code in pastebin https://pastebin.com/pgZK7kwC This is my first project.. i know very bad programmcode :p – Daywalker May 01 '21 at 22:24
  • I expected that you use some module and code to use barcode scanner - but it seems it send text automatically like keyboard. I have two ideas. First: if you `unfocus` `barcode_input` then it will not send data to `barcode_input`. And later you have to `focus` again. Second: remeber last `data` and `time` and compare it with current `data` and `time` - if you get the same `data` in short time then you should skip it. – furas May 01 '21 at 22:59
  • The first 1 with focus dont work. But the second one with compare in python i dont know how. Can you show me on my code in pastebin pls? – Daywalker May 02 '21 at 01:22
  • at start create variable `previous_input = ""` and when you get new `input` then compare it with previous value `input == previous_input` to run or skip SQL, and after comparing assign current input to `previous_input = input` to use it next time. The same you can do with `previous_time` to control how long ago you get previous input - if it is very short time then you may skip SQL, if it is longer time then maybe someone use `membership cards` again. – furas May 02 '21 at 01:34
  • Perfect now its work fine, Thank you men:) – Daywalker May 02 '21 at 02:46

0 Answers0