I'm trying to code the game of minesweeper. For some reason, the image won't display properly--and it isn't a case of a missing file, b/c I have a try-except code snippet that is set to print out an error message should this occur, and that isn't happening. So either it's misreading the image or just not displaying it properly.
Here is the relevant code (obviously this is a work-in-progress):
if adjMines>0: self.square[x][y]['text'] = adjMines try: image =  image.append(PhotoImage(file='1.gif')) image.append(PhotoImage(file='2.gif')) self.square[x][y]['text'] = adjMines except (IOError): print 'File missing.' else: if adjMines == 1: self.square[x][y]['text'] = '' self.square[x][y]['image'] = image elif adjMines == 2: self.square[x][y]['text'] = '' self.square[x][y]['image'] = image
BTW, the text thing was what I had going on in the alpha version of the program: It would change the button's text to the appropriate number.
Here is what it looks like:
(And yes, I know the square sizes are goofy. I'm still in the development phase of this program. ETA: On the same token, the 'X' is a mine.)
More importantly, why am I just getting these little gray squares?
Edited by toll_booth: clarifying what the 'X' is