SHARE
TWEET

Untitled

a guest Jan 11th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top