Apr-05-2019, 01:19 PM
Hi jpezz
You have to bind the tk-image to an object. In your case for instance to the object root. The canvas needs a layout membership for which i choosed pack. For the canvas.create_image add for instance the option anchor='nw'. So the x/y-coordinates relate to the upper left corner of the image. In your case the image would be place outsite of the visuable surface of the canvas:
You have to bind the tk-image to an object. In your case for instance to the object root. The canvas needs a layout membership for which i choosed pack. For the canvas.create_image add for instance the option anchor='nw'. So the x/y-coordinates relate to the upper left corner of the image. In your case the image would be place outsite of the visuable surface of the canvas:
from Tkinter import * from PIL import Image, ImageTk root = Tk() # Remove titlebar #root.overrideredirect(1) canvas = Canvas(root, width =200,height=200) canvas.pack() image = Image.open("pngs/a.jpg") #logo=PhotoImage(file="pngs/a.jpg) root.logo = ImageTk.PhotoImage(image) canvas.create_image(10, 10, image=root.logo, anchor='nw') root.mainloop()wuf :-)