Python Tkinter Error, “Too Early to Create Image”

Posted on

Question :

Python Tkinter Error, “Too Early to Create Image”

So I have an assignment that I have to use Tkinter to create a board game. This is just one part of the program where I want to bring in the image of the board. But I keep on getting the error, “Too early to create image” and I’m not sure what I’m doing wrong.

Here’s my code so far:

from Tkinter import *
from pprint import pprint

# Which variable is currently updating
from variableColors import Variables
VariableIndex = 0               
VariableText = Variables[VariableIndex]

Ids = None             # Current canvas ids of the text and 4 player tokens:
                       # Will be None if not committed

VariableCoords = { }       # Where store variable and coordinates

im = PhotoImage(file="C:UsersKikiDesktopAssignment\")
photo = can.create_image(0,0,anchor=NW, image=im)



Any help would be appreciated. Thanks 🙂

Asked By: emagdnim


Answer #1:

You forgot to declare root – root = Tk().
The Tk system must be ON before using it.

Answered By: Israel Unterman

Leave a Reply

Your email address will not be published. Required fields are marked *