Last active
June 18, 2019 15:57
-
-
Save sa1f/96f2ee487dec196376bdb0a40f822be4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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