tahamajs's picture
download
raw
724 Bytes
import qrcode
from PIL import Image, ImageTk
class QRManager:
def __init__(self):
self.last_pil_image = None
self.tk_image = None
def generate(self, ip: str, port: int) -> ImageTk.PhotoImage:
qr_data = f"airmouse://{ip}:{port}"
qr = qrcode.QRCode(
version=None,
error_correction=qrcode.constants.ERROR_CORRECT_H,
box_size=8,
border=2,
)
qr.add_data(qr_data)
qr.make(fit=True)
img = qr.make_image(fill_color="#111111", back_color="#ffffff").convert("RGB")
img = img.resize((220, 220))
self.last_pil_image = img
self.tk_image = ImageTk.PhotoImage(img)
return self.tk_image

Xet Storage Details

Size:
724 Bytes
·
Xet hash:
9a61b529a4a4910e8be26055e2c9dadac2165dbb8381caa8bc5224a2d8fabd0e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.