The following short code is meant to create an array with numpy, convert it into an image object with PIL and then insert into a canvas on a tkinter window.
from tkinter import *
from PIL import Image
root = Tk()
array = np.ones((40,40))*150
img = Image.fromarray(array)
canvas = Canvas(root,width=300,height=300)
canvas.pack()
canvas.create_image(20,20,anchor=NW,image=img)
root.mainloop()
This throws the error:
TclError: image "<PIL.Image.Image image mode=F size=40x40 at 0x7F42D3BC3290>" doesn't exist