本文整理汇总了Python中qrtools.QR.data_to_string方法的典型用法代码示例。如果您正苦于以下问题:Python QR.data_to_string方法的具体用法?Python QR.data_to_string怎么用?Python QR.data_to_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qrtools.QR
的用法示例。
在下文中一共展示了QR.data_to_string方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: readtextfromQR
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import data_to_string [as 别名]
def readtextfromQR():
try :
from qrtools import QR
from codecs import BOM_UTF8
except ImportError :
print('Module qrtools missing! No QR-code import possible!')
raise
myCode = QR()
myCode.decode_webcam()
key = myCode.data_to_string().strip()
return key[len(BOM_UTF8):] # fixes zbar!
示例2: check_image_qr
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import data_to_string [as 别名]
def check_image_qr(self, path):
myCode = QR(filename=path)
if myCode.decode():
self.qr_link = myCode.data_to_string()
self.copy_link.set_sensitive(True)
alert = NotifyAlert(10)
alert.props.title = _("Code found")
alert.props.msg = _("Click on toolbar button for "
"copy link to clipboard.")
alert.connect("response", lambda x,
y: self.activity.remove_alert(x))
self.activity.add_alert(alert)
else:
self.qr_link = None
self.copy_link.set_sensitive(False)
alert = NotifyAlert(10)
alert.props.title = _("Code not found")
alert.props.msg = _("Try again, please focus the Qr "
"Code in the camera.")
alert.connect("response", lambda x,
y: self.activity.remove_alert(x))
self.activity.add_alert(alert)
self.stop_play.set_sensitive(False)
示例3: int
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import data_to_string [as 别名]
resolution_level = 9
num_cases = int(sys.stdin.readline())
for num_case in range(num_cases):
text_squares = sys.stdin.readline().rstrip('\r\n').split()
squares = [ parse_square(s) for s in text_squares ]
s = squares[0]
for i in range(1, len(squares)):
s = add_squares(s, squares[i])
qrname = u'case%d_sum.png' % (num_case + 1)
create_png(qrname, s, resolution_level)
myCode = QR(filename=qrname)
if myCode.decode():
#m = md5.new()
#m.update(myCode.data_to_string())
#print m.hexdigest()
secret = myCode.data_to_string()
# Strip non iso-8859-1 characters
secret = secret.decode('utf-8')
secret = secret.encode('iso-8859-1', 'ignore')
print secret
示例4: range
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import data_to_string [as 别名]
# bruteforce missing section until readable
count=0
for i in itertools.product('01', repeat=60):
count+=1
if count%1000 ==0:
print count
for x in range(1,12):
for y in range (10,14):
if( i[((y-10)%4)*11 + x] == '0' ):
pixels_out[x,y]=(0,0,0)
outimg=outimg.resize((300,300))
outimg.save("dec17_out.png","png")
# read qr code
nugget=''
myCode = QR(filename="dec17_out.png")
if myCode.decode():
nugget=myCode.data_to_string()
print nugget
break
#else:
# print "could not decode"
#break
示例5: QR
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import data_to_string [as 别名]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# qrgen1.py
#
# Copyright 2013 psutton <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
from qrtools import QR
myCode = QR(filename=u"/home/psutton/Documents/Python/qrcodes/qrcode.png")
if myCode.decode():
print myCode.data
print myCode.data_type
print myCode.data_to_string()
示例6: QR
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import data_to_string [as 别名]
from qrtools import QR
import sys
#import argparse
arg = sys.argv
code = QR(filename=arg[1])
if code.decode():
print "QR decoded data is : ", code.data
print code.data_type
print code.data_to_string()
示例7: decodeWebcam
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import data_to_string [as 别名]
def decodeWebcam(self):
qr = QR()
qr.decode_webcam()
if qr.data_to_string() != 'NULL':