Guest User

Untitled

a guest
Jan 11th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import tkinter as tk
  2. from PIL import ImageTk, Image
  3.  
  4. def show_image(path):
  5. image_window = tk.Tk()
  6. img = Image.open(path)
  7. width = 500
  8. ratio = (width / float(img.size[0]))
  9. height = int((float(img.size[1]) * float(ratio)))
  10. imag = img.resize((width, height), Image.ANTIALIAS)
  11. image = ImageTk.PhotoImage(imag)
  12. panel = tk.Label(image_window, image=image)
  13. panel.pack(side="top", fill="both", expand="yes")
  14. image_window.mainloop()
  15.  
  16. show_image('e.jpg')
Add Comment
Please, Sign In to add comment