Python Forum
[Tkinter] trace_add question
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] trace_add question
#1
Hi,
I am working on an app that reads input into an entrybox, coming from a barcode reader .
I created the barcodes myself, and printed them out.
A typial one would read 'A01-YES' (It clearly shows underneath the bars)
def callback(*_): 
    print(curScan.get())
curScan.trace_add("write",callback)
It all works fine except...
In the print that I get, systematically the hyphen changes into "§". It prints 'A01§YES'
I created the barcodes with 'code128'
My IDLE editor is 'unifont'.
Where should i look ?
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply
#2
After some research, I suspect that the barcode reader
emulates a slightly different keyboard than the one I'm using.
(Slightly because letters and numbers are OK)
Nothing a regex can't repair Smile

Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply
#3
emmitted character 00A7 Hex
hyphen is 00AF or 002D Hex (two occurrences)

symbology defined in ISO/IEC 15417:2007 https://www.iso.org/standard/43896.html
Should look like:
   
You can try codes here: https://barcode.tec-it.com/en/Code128?data=A01-YES
character set used by code 128 is IEC_8859-1
Reply
#4
(Sep-02-2021, 02:36 PM)Larz60+ Wrote: emmitted character 00A7 Hex
hyphen is 00AF or 002D Hex (two occ)
You can try codes here: https://barcode.tec-it.com/en/Code128?data=A01-YES
character set used by code 128 is IEC_8859-1
The barcodes generated by the app above are line per line the same
as the ones I generate via the python app in .svg.

It is not the "fault" of the hyphen, because when i try with "#" as separtator,
it also fails. The barcode scanner has very little documentation.
Bus as I said, regex is your friend.
thanks,
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply
#5
DPaul Wrote:I created the barcodes myself, and printed them out.
If you compare your printed barcode to the image I posted, do they match?

I wrote a lot of barcode printing programs for various xerox high speed hang tag printers back in the 1980's.
Scaling was an issue back then. I'm sure there have been many advances over the past 25 years.

I found a lot of very subtle problems with thickness of lines and spaces as well as scale, so provided previous post for you to compare with your code.

Also, of course it could indeed be the reader, what type of reader are you using?
Reply
#6
Hi,

As far as i can see, on magnified images, yours and mine
are the same line per line, except that yours has a few dark grey
areas instead of white between the black lines.

I am using a NETNUM usb barcode reader, pretty recent.
In the box there is only a booklet with barcodes, but no explanation.
They seem to affect the firmware, because I just did "reset configuration to defaults",
and now nothing is correct any more. Now I have to figure out which one
will set it back to +/- normal, there are about 150 of them.

Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply
#7
Code 128 is not as common as other Barcodes, so probably is not the default choice.
That's probably 'UPC-A' or 'UPC-E'.

What is the NETNUM Model name or number? is it this one? https://www.amazon.com/NETUM-Handheld-Ba...B01MRLRVCI

This one looks like 'No software needed ... Trust Us'. If you search google, a better manual, or at least a blog on the device might be available for download.

manual possibly here?: https://gzxlscan.com/barcode-scanner-user-manuals/
Reply
#8
(Sep-03-2021, 11:00 AM)Larz60+ Wrote: What is the NETNUM Model name or number? is it this one? https://www.amazon.com/NETUM-Handheld-Ba...B01MRLRVCI
No it is model F5, and i can only find manuals of "lookalikes".
But after a few tests, it is clear to me that it is emulating a slightly different keyboard.
As I said, I consider the problem solved.
Paul
Larz60+ likes this post
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020