Jun-18-2020, 03:26 AM
(Jun-18-2020, 03:03 AM)deanhystad Wrote: This program fails too:
from tkinter import * image = PhotoImage(file='image.png')The error is
This program runs
Output:Traceback (most recent call last): File "C:\Users\djhys\Documents\python\musings\junk.py", line 3, in <module> image = PhotoImage(file='image.png') File "C:\Program Files\Python38\lib\tkinter\__init__.py", line 4061, in __init__ Image.__init__(self, 'photo', name, cnf, master, **kw) File "C:\Program Files\Python38\lib\tkinter\__init__.py", line 3994, in __init__ raise RuntimeError('Too early to create image') RuntimeError: Too early to create image
from tkinter import * Tk() image = PhotoImage(file='image.png')
deanhystad THANK YOU!
You're totally right, to use the PhotoImage method I have to call it inside the Tk() loop and now that I did that my code is working!
Again thank you!