Форум сайта python.su
from tkinter import *
from PIL import ImageTk, Image
root = Tk ( )
root.geometry ('450x330')
canvas = Canvas (root, width=800, height=600)
canvas.pack ( )
def load_image(name):
img = Image.open (name)
img.thumbnail ((200, 300), Image.ANTIALIAS)
return ImageTk.PhotoImage (img)
def set_image(image):
canvas.delete (“all”)
canvas.create_image (110, 115, image=image)
image = load_image (“mini_img.png”)
image2 = load_image (“keks2.png”)
set_image (image)
def crop() -> object:
karin = set_image (image)
area = (200, 150, 150, 100)
cropped_img = karin.crop (area)
def naz():
set_image (image2)
def mag():
set_image (image)
def karin():
pass crop()
btn1 = Button (root, text=“Назад”, width=25, command=naz)
btn1.place (x=25, y=240)
btn2 = Button (root, text=“вперед”, width=25, command=mag)
btn2.place (x=240, y=240)
btn3 = Button (root, text=“обрезать”, width=25, command=karin)
btn3.place (x=200, y=150)
root.mainloop ( )
Офлайн
По моему это не весь код, а всего его обрубок, где начало то ?
Офлайн