How can I set a tkinter app icon with a URL

 # Create the main window

window = tk.Tk()
window['bg'] = '#1f2126'
window.resizable(False, False)
window.geometry("250x150")
# setting GUI title
window.title("10PROXY")

# download the icon image from the URL
response = requests.get("https://cdn-icons-png.flaticon.com/512/9764/9764923.png")
# save the image to a local file
with open("9764923.png", "wb") as f:
f.write(response.content)

icon = tk.PhotoImage(file="9764923.png")
window.iconphoto(True, icon)

# window.iconbitmap("icon.ico")

Post a Comment

Previous Post Next Post