本文整理匯總了Python中qrcode.ERROR_CORRECT_M屬性的典型用法代碼示例。如果您正苦於以下問題:Python qrcode.ERROR_CORRECT_M屬性的具體用法?Python qrcode.ERROR_CORRECT_M怎麽用?Python qrcode.ERROR_CORRECT_M使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類qrcode
的用法示例。
在下文中一共展示了qrcode.ERROR_CORRECT_M屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: make_qr_data
# 需要導入模塊: import qrcode [as 別名]
# 或者: from qrcode import ERROR_CORRECT_M [as 別名]
def make_qr_data(text):
qr_image = qrcode.make(
text, box_size=1, border=0,
error_correction=qrcode.ERROR_CORRECT_M)
qr_pet = []
print(qr_image.size)
for y in range(25):
for x in range(40):
pattern = (
get_pix(qr_image, x*2, y*2),
get_pix(qr_image, x*2+1, y*2),
get_pix(qr_image, x*2, y*2+1),
get_pix(qr_image, x*2+1, y*2+1),
)
p = charmap[pattern]
qr_pet.append(p)
return bytes(qr_pet)
示例2: __init__
# 需要導入模塊: import qrcode [as 別名]
# 或者: from qrcode import ERROR_CORRECT_M [as 別名]
def __init__(self, origin, data, box_size, version=None, error_correction=ERROR_CORRECT_M, border=0,
alignment='left-bottom'):
self._qr_code = qrcode.QRCode(image_factory=ShapelyImageFactory, error_correction=error_correction,
border=border, box_size=1, version=version)
self._qr_code.add_data(data)
self._alignment = Alignment(alignment)
self.box_size = box_size
self.origin = origin
示例3: _example
# 需要導入模塊: import qrcode [as 別名]
# 或者: from qrcode import ERROR_CORRECT_M [as 別名]
def _example():
qr_code = QRCode([0, 0], 'A0.0', 1.0, version=1, error_correction=QRCode.ERROR_CORRECT_M)
from gdshelpers.geometry.chip import Cell
device = Cell('test')
device.add_to_layer(1, qr_code)
device.show()
chip = Cell('optical_codes')
chip.add_cell(device)
chip.start_viewer()
chip.save()
示例4: qrcode_view
# 需要導入模塊: import qrcode [as 別名]
# 或者: from qrcode import ERROR_CORRECT_M [as 別名]
def qrcode_view(request, key):
wallet = get_object_or_404(Wallet, key=key)
img = qrcode.make(
wallet.bcaddr_uri, box_size=6, error_correction=qrcode.ERROR_CORRECT_M)
output = StringIO.StringIO()
img.save(output, "PNG")
c = output.getvalue()
return HttpResponse(c, content_type="image/png")
示例5: qrcode_img
# 需要導入模塊: import qrcode [as 別名]
# 或者: from qrcode import ERROR_CORRECT_M [as 別名]
def qrcode_img(text):
img = qrcode.make(text, box_size=2, error_correction=qrcode.ERROR_CORRECT_M)
output = StringIO.StringIO()
img.save(output, "PNG")
c = output.getvalue()
return c