from tkinter import *
from PIL import Image, ImageTk, ImageDraw
import sys
def resize_image():
original_image = Image.open("1.png")
w, h = original_image.size
w = w + 50
h = h + 50
resized_image = original_image.resize((w,h))
resized_image.save("1.png")
def mscale():
resize_image()
global root,img,imgArea,canvas
img = PhotoImage(file="1.png")
imgArea = canvas.create_image(0,0, image=img,anchor = NW)
pass
def mexit():
sys.exit(0)
root = Tk()
root.geometry('1000x1000')
mainmenu = Menu(root)
root.config(menu=mainmenu)
filemenu = Menu(mainmenu, tearoff=0)
filemenu.add_command(label="Масштабировать",command=mscale)
filemenu.add_command(label="Выход",command=mexit)
mainmenu.add_cascade(label="Команды", menu=filemenu)
canvas = Canvas(root, width=999, height=999, bg='white')
canvas.place(x = 0 , y = 0)
img = PhotoImage(file='1.png')
imgArea = canvas.create_image(0,0, image=img,anchor = NW)
root.mainloop()
|