Quantcast
Channel: How do I setup a window Icon using Tkinter? - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by jizhihaoSAMA for How do I setup a window Icon using Tkinter?

$
0
0

tkinter.PhotoImage only support GM, PPM, GIF, PNG image.Your image is JPEG,for sure it will raise Exception.

There are some solutions,but the direct way is to change the image extension to ico and use iconbitmap()

from PIL import Imageimg = Image.open(r"xxx.jpeg") # your jpeg image pathimg.save(r"Icon.ico")

This will generate a new ico image in your current path.

Then you can use iconbitmap('Icon.ico') directly.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>