Original Post
I'm working on a simple turn-based strategy game in Python and I'm at the stage where all the gameplay rules have been set down and I'm coding the graphics engine. I'm throwing some images into the program to test it and IDLE is telling me that it's "too early" to create the images. I created them before I used them- what's early about that? Here's the method in question:
def drawmap(self):
grass = PhotoImage(file="grass.gif")
rock = PhotoImage(file="rock.gif")
tree = PhotoImage(file="tree.gif")
field = PhotoImage(file="field.gif")
for i in range(1, 11):
for j in range(1, 11):
if self.mapGrid[i*j] == "g":
self.drawarea.create_image(i*40, j*40, image = grass)
elif self.mapGrid[i*j] == "r":
self.drawarea.create_image(i*40, j*40, image = rock)
elif self.mapGrid[i*j] == "f":
self.drawarea.create_image(i*40, j*40, image = field)
elif self.mapGrid[i*j] == "t":
self.drawarea.create_image(i*40, j*40, image = tree)
print 'canvas drawn'