gpt4 book ai didi

python - 使用 xvkbd 读取条形码。如何禁用Enter键?

转载 作者:行者123 更新时间:2023-12-01 06:18:39 25 4
gpt4 key购买 nike

我正在使用 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

键盘.sh

python read_one.py | xvkbd -file -

如何在将条形码发送到 xvkbd 之前删除“\n”或禁用 xvkbd 中的 Enter 键?

最佳答案

试试这个:

printf "$(python read_one.py)" | xvkbd -file -

关于python - 使用 xvkbd 读取条形码。如何禁用Enter键?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1844457/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com