0
from urllib.request import urlopen
from tkinter import *
from PIL import ImageTk, Image

screen = Tk()
screen.title("Top Movies of The Week")
screen.config(padx=50, pady=50, bg="red")

image_url = "https://m.media-amazon.com/imag/M/MV5BYTRiNDQwYzAtMzVlZS00NTI5LWJjYjUtMzkwNTUzMWMxZTllXkEyXkFqcGdeQXVyNDIzMzcwNjc@._V1_.jpg"
u = urlopen(image_url)
raw_data = u.read()

photo = ImageTk.PhotoImage(data=raw_data)

label = Label(image=photo)
label.pack()

screen.mainloop()
TheLizzard
  • 7,248
  • 2
  • 11
  • 31
Clay
  • 11
  • 3
  • Look at how to use the `PIL` image library. It has a resize method and also has `PIL.ImageTk.PhotoImage` to convert the image to `tkinter` – TheLizzard Oct 16 '22 at 08:52
  • i have tried can you please tell me where i apply resize – Clay Oct 16 '22 at 09:16
  • Look at [this](https://stackoverflow.com/a/23489503/11106801) but add `.resize((, ))` at the end of `Image.open(...)`. To add the image to `tkinter`, look it up online – TheLizzard Oct 16 '22 at 09:23
  • 1
    `resized = Image.Open(u).resize((width, height))`, then `photo = ImageTk.PhotoImage(resized)`. – acw1668 Oct 16 '22 at 09:49
  • its working brother thanks alot i have no words to thank you – Clay Oct 16 '22 at 09:58

0 Answers0