Now you can resize qr; fix dependencies
This commit is contained in:
anqude 2023-01-10 02:54:11 +04:00 committed by GitHub
parent 6f30a52b5c
commit e60ceb09b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -1,4 +1,4 @@
from customtkinter import CTk,CTkLabel,CTkButton,CTkEntry,CTkCheckBox,CTkToplevel,CTkImage
from customtkinter import CTk,CTkLabel,CTkButton,CTkEntry,CTkCheckBox
from PassgenCLI import *
from tkinter import IntVar,END,PhotoImage
from qr import generate_qr
@ -102,15 +102,23 @@ def genadiy():
window.title("QR")
window.tk.call('wm', 'iconphoto', window._w, PhotoImage(file='qr.png'))
bg = ImageTk.PhotoImage(file="qr.png")
canvas = Canvas(window)
canvas = Canvas(window,)
canvas.configure(bg="black")
canvas.pack(fill="both", expand=True)
canvas.create_image(0,0,image=bg, anchor='nw')
def resize_image(win):
global image, resized, image2
image = Image.open("qr.png")
resized = image.resize((win.width, win.height), Image.Resampling.LANCZOS)
wide=win.width
high=win.height
if high < wide:
wide=high
else:
high=wide
resized = image.resize((wide, high))
image2 = ImageTk.PhotoImage(resized)
canvas.delete("all")
canvas.create_image(0, 0, image=image2, anchor='nw')
window.bind("<Configure>", resize_image)

View File

@ -10,7 +10,7 @@ pip install tk pyperclip qrcode customtkinter qrcode password-strength
**On debian**
```sh
sudo apt install python3-tk python3-pil.imagetk pytho3-pip python3
sudo apt install python3-tk python3-pil.imagetk python3-pip python3
```
**On fedora**