QR codes: use half-block characters
Hunter
Monday, April 27th, 2026 at 3:40 PM
120 # Get the QR code matrix
121 matrix = qr.get_matrix()
122
- # Print QR code using block characters
- # Use full block (█) for black and space for white
123 print("\nScan to connect:")
- for row in matrix:
124 + for y in range(0, len(matrix), 2):
125 line = ""
- for cell in row:
- line += "██" if cell else " "
126 + for x in range(len(matrix[y])):
127 + top = matrix[y][x]
128 + bottom = matrix[y + 1][x] if y + 1 < len(matrix) else False
129 + if top and bottom:
130 + line += "█"
131 + elif top:
132 + line += "▀"
133 + elif bottom:
134 + line += "▄"
135 + else:
136 + line += " "
137 print(line)
138 print()
139 except ImportError: