Skip to content

Instantly share code, notes, and snippets.

@sa1f
Last active June 18, 2019 15:57
Show Gist options
  • Save sa1f/96f2ee487dec196376bdb0a40f822be4 to your computer and use it in GitHub Desktop.
Save sa1f/96f2ee487dec196376bdb0a40f822be4 to your computer and use it in GitHub Desktop.
from io import BytesIO
import urllib3
import tkinter as tk
from PIL import Image, ImageTk
root = tk.Tk()
url = "https://logo.clearbit.com/spotify.com" # Put companyname.com at the end
http = urllib3.PoolManager()
response = http.request('GET', url)
raw_data = response.data
im = Image.open(BytesIO(raw_data))
image = ImageTk.PhotoImage(im) # This is equivalent to a regular PhotoImage so just use this
# whereever you need a PhotoImage
label = tk.Label(image=image) # Just an example
label.pack()
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment