Skip to content Skip to sidebar Skip to footer

Drawing A Png Image On A Tkinter Canvas Python

I am trying to create a simple game using tkinter in python 3.5 using the canvas widget. For this game I am need to be able to use a transparent (png) image. Here is my code: from

Solution 1:

You should try this:

from tkinter import * 
root = Tk()
canvas = Canvas(root, width=500, height=500)
canvas.pack()
img = PhotoImage(file='path/your_image.png')
canvas.create_image(250, 250, image=img)
root.mainloop()

Output here


Post a Comment for "Drawing A Png Image On A Tkinter Canvas Python"