As below, I want to show a picture in the canvas using the tanker, and when click on a button, Another photo should have been shown. But the first image I failed is displayed well, but when I click on the button
C = Tkinter.Canvas (top, BG = "#FFF", height = 500, width = 600) // show first in canvas and it works ITK = ImageTk.PhotoImage (img1) C.create_image (300, 250, image = ITK) C.pack () def changeImage (): / / I want to show the image in the canvas, but I print the image 'change in canvas image' itk2 = ImageTk.PhotoImage (img2) c. Ccreate_image (300, 250, image = itk2) button = Tkinter.Button (top, text = 'click', command = changeImage) button fails to print .pack () top.mainloop ()
One or more options for all matches are not items.
myimg = C.create_image (300, 250, image = itk) def changeImage (): // I have to show the image in the canvas 2, but I can print the 'image change in canvas' itk2 Fails in = ImageTk.PhotoImage (img2) C.itemconfigure (myimg, image = itk2)
Comments
Post a Comment