I am using Visual Studio Code, Python, and Tkinter in this program and I want to import and display an image from my computer as a screen(it is in the end). I tried to import the image by copying a statement from a video example I However, when I run the program, it says
tkinter.TclError: bitmap "IMAGE.jpg" not defined
import tkinter
from tkinter import Tk
from PIL import ImageTk, Image
screen = Tk()
screen.iconbitmap("IMAGE.jpg")
CodePudding user response:
As far as I know, .jpg is not supported. Try converting it to .ico format. There are online tools, just upload your .jpg and download .ico.
CodePudding user response:
I know this error as this happened with me also. So I know the solution. The Solution is - Python tkinter supports only .ico images for (WINDOWS). So if you want to convert the .jpg to .ico just use https://cloudconvert.com and drop your jpg file and click the dropdown menu and choos the .ICO option and then convert it and then download it and just use it and you are done. Please rate me if this helped me