I used root.iconbitmap("icon.ico")
in my code and uploaded a picture with the same name, but I code error while trying to put it on the program icon. Has anyone figured out what the problem is? Is it a bug?
please send the repl link?
… I can’t copy paste that into a repl
Just use iconbitmap. You can copy paste it from photo by Google Lens.
I don’t understand why you can’t jjust copy paste that portion in and I want the full code because I know full well that no human being is unerring and that the error could be somewhere different than you suspect
But wait, you can try to set icon in your own Repl. If you will be able to do it, it is fault in my code. Just import Tkinter, create Tk, set the size and try to set the picture also.
I have provided all the necessary information. Thank you for your understanding.
no you have not provided all necessary information. However, while I do not even use tkinter, I can tell you what probably happened merely by a quick google. You’re basically using a ico setter that only lets you set black and white images (according to this). Thus, you can try using the following code instead:
root = Tk()
img = PhotoImage(file='your-icon')
root.tk.call('wm', 'iconphoto', root._w, img)
did this solve your problem?
couldn’t regonize data in image file means you have a corrupted ico file
Okay, I will try another one.
at least that’s what I think
Thank you really much!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.