fix image resize,add graph icon

This commit is contained in:
anqude 2023-02-05 20:52:56 +04:00 committed by GitHub
parent c017f51042
commit 3ca8c9a75c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 9 deletions

View File

@ -42,7 +42,7 @@ def Checkvariables():
entry=CTkEntry(tabview.tab("Line"),width = 320) entry=CTkEntry(tabview.tab("Line"),width = 320)
entry.place(x=14, y=15) entry.pack(padx=14, pady=15, fill="x")
Chspec = IntVar() Chspec = IntVar()
@ -118,15 +118,16 @@ def genadiy():
bg = ImageTk.PhotoImage(file="qr.png") bg = ImageTk.PhotoImage(file="qr.png")
label = Label(window,background=bg_color,highlightbackground=bg_color) label = Label(window,background=bg_color,highlightbackground=bg_color)
label.pack(fill="both", expand=True,anchor='center') label.pack(fill="both", expand=True,anchor='center')
counter_loop=[0]
def resize_image(win): def resize_image(win):
image = Image.open("qr.png") if counter_loop[0]%3==0:
size=min(win.width,win.height) image = Image.open("qr.png")
resized = image.resize((size, size)) size=min(win.width,win.height)
image2 = ImageTk.PhotoImage(resized) resized = image.resize((size, size))
window.image2=image2 image2 = ImageTk.PhotoImage(resized)
label.configure(image=image2) window.image2=image2
label.configure(image=image2)
counter_loop.insert(0,counter_loop[0]+1)
window.bind("<Configure>", resize_image) window.bind("<Configure>", resize_image)
window.mainloop() window.mainloop()
@ -167,6 +168,7 @@ def gena():
root.configure(background="#242424") root.configure(background="#242424")
root.title("Graph") root.title("Graph")
root.geometry("200x200") root.geometry("200x200")
root.tk.call('wm', 'iconphoto', root._w, PhotoImage(file='./ui/graph.png'))
resx,resy=400,400 resx,resy=400,400
canvas = Canvas(root,background=bg_color,highlightbackground=bg_color) canvas = Canvas(root,background=bg_color,highlightbackground=bg_color)
canvas.pack(fill="both", expand=True) canvas.pack(fill="both", expand=True)

BIN
ui/graph.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB