Ok so this seems working, but now I want to implement this image displaying feature into my for cycle. It should look like this:
The whole black area should be covered with such a green grass tiles, but when I replace image of a grass by basic green color tile, it works. Can you help me?
for i in range(self.height // self.field_size): for j in range(self.width // self.field_size): self.field_icon = tkinter.PhotoImage(file="GroundGravel_Grass.png") if self.layout[field] == "0": self.canvas.create_image(j*50, i*50, anchor=NW, image=self.field_icon) elif self.layout[field] == "1": self.canvas.create_rectangle(j*50, i*50, j*50+self.field_size, i*50+self.field_size, fill="blue", outline="yellow") elif self.layout[field] == "2": self.canvas.create_rectangle(j*50, i*50, j*50+self.field_size, i*50+self.field_size, fill=self.sand, outline="yellow")Basically, this program reads a file with number 0, 1 and 2 and according to specific numbers it should put an image to the correct position (according to "i" and "j") and so create a square grid (should work as a playfield later). You can see that in case of numbers 1 and 2 I have just colors yet, I stopped there, because even number 0 didn´t work with a picture of a grass. It draws just a last square, image here:
The whole black area should be covered with such a green grass tiles, but when I replace image of a grass by basic green color tile, it works. Can you help me?