Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Tutorials listed in this section have not been reviewed nor are affliated by Code Forum. It is the sole responsbility of the authour to properly maintain and ensure information is accurate.

Python Tkinter taskbar image from the web

How to use a image from the web for tkinters taskbar icon

Python:
# Do the imports
import tkinter as tk
from urllib.request import urlopen

# Initiate the root window
root = tk.Tk()

# get the image from an url
img_url = urlopen('https://my-python.org/images/png/ratt.png')

# Read the data from the image
img = img_url.read()

# Use tkinter PhotoImage encode the image
image = tk.PhotoImage(data=img)

# Set the taskbar icon - True to show on all windows False to show on current window
root.wm_iconphoto(True,image)
root.mainloop()
 

Buy us a coffee!

Back
Top Bottom