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

How do I setup a window Icon using Tkinter?

$
0
0

I'm trying to set up a window Icon so it would appear right next to the name of a dictionary I'm doing. When I run the code, I get the following problem:

Traceback (most recent call last):  File "/Users/sergioley-languren/Latin_app/windows.py", line 20, in <module>    window.iconphoto(False, tk.PhotoImage(file='/Users/sergioley-languren/home/Latin_app/Logo.jpeg'))  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/__init__.py", line 4061, in __init__    Image.__init__(self, 'photo', name, cnf, master, **kw)  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/__init__.py", line 4006, in __init__    self.tk.call(('image', 'create', imgtype, name,) + options)_tkinter.TclError: couldn't recognize data in image file "/Users/sergioley-languren/Latin_app/Logo.jpeg"

When I tried to use the iconbitmap tkinter function with the .jpeg file converted to a .ico picture, it worked, but I got a blank page icon instead. The code below is the problematic code:

### Importsimport tkinter as tkfrom tkinter import *from pathlib import Path##Extra Codehome = print(Path.home())### Application screen codewindow = Tk()##Frameframe1 = Frame(window)frame1.pack()## Window Titlewindow.title("Latin Unit 1 Dictionary - Based on Orion Academy Latin I , Unit 1")window.geometry('1110x950')#App Iconwindow.iconphoto(False, tk.PhotoImage(file='/Users/sergioley-languren/home/Latin_app/Logo.jpeg'))## Window Main Loopwindow.mainloop()

Could anyone tell me how to fix it? (If it helps, I'm using MacOs Catilina.)


Viewing all articles
Browse latest Browse all 3

Trending Articles



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