Related questions
How to clear Tkinter Canvas?
When I draw a shape using:
canvas.create_rectangle(10, 10, 50, 50, color="green")
Does Tkinter keep track of the fact that it was created?
In a simple game I'm making, my code has one Frame create a bunch of rectangles, and then …
How to insert an image in a canvas item?
I am working on a game project for school, which look like this : In-game aspect
I have created these colored polygons like this :
ship = can.create_polygon(410,650,450,600,490,650 , fill= 'red' , outline='black')
ennemies = can.create_rectangle(x-r, y-r, x+r, y+…
Why does Tkinter image not show up if created in a function?
This code works:
import tkinter
root = tkinter.Tk()
canvas = tkinter.Canvas(root)
canvas.grid(row = 0, column = 0)
photo = tkinter.PhotoImage(file = './test.gif')
canvas.create_image(0, 0, image=photo)
root.mainloop()
It shows me the image.
Now, this code compiles but …