Thursday, April 19, 2012

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:\Users\Kiki\Desktop\Assignment\\")
photo = can.create_image(0,0,anchor=NW, image=im)

can.pack()


root.mainloop()


Any help would be appreciated. Thanks :)





No comments:

Post a Comment