Найти - Пользователи
Полная версия: помогите,до сдачи работы 3 часа,не могу сделать так,что бы при нажатие на кнопку,фото обрезалось
Начало » Центр помощи » помогите,до сдачи работы 3 часа,не могу сделать так,что бы при нажатие на кнопку,фото обрезалось
1
voshod
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 ( )
Alexru84
По моему это не весь код, а всего его обрубок, где начало то ?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB