Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from PIL import ImageTk, Image
- def show_image(path):
- image_window = tk.Tk()
- img = Image.open(path)
- width = 500
- ratio = (width / float(img.size[0]))
- height = int((float(img.size[1]) * float(ratio)))
- imag = img.resize((width, height), Image.ANTIALIAS)
- image = ImageTk.PhotoImage(imag)
- panel = tk.Label(image_window, image=image)
- panel.pack(side="top", fill="both", expand="yes")
- image_window.mainloop()
- show_image('e.jpg')
Add Comment
Please, Sign In to add comment