ウェブカメラのウェブカメラからバーコードを読み取るためにzbarcamを使用しています。しかし、zbarcamは最後に\ nを表示するので、私のフォームは送信されます。
これが私が使用するものです:
read_one.py
#!/usr/bin/python
from sys import argv
import zbar
import webbrowser
# create a Processor
proc = zbar.Processor()
# configure the Processor
proc.parse_config('enable')
# initialize the Processor
device = '/dev/video0'
if len(argv) > 1:
device = argv[1]
proc.init(device)
# enable the preview window
proc.visible = True
# read at least one barcode (or until window closed)
proc.process_one()
# hide the preview window
proc.visible = False
# extract results
for symbol in proc.results:
# do something useful with results
print symbol.data
Keyboard.sh
python read_one.py | xvkbd -file -
バーコードをxvkbdに送信する前に「\n」を削除するか、xvkbdのEnterキーを無効にするにはどうすればよいですか?