def makeImage(self, purpose, dimensions, canvas):
"""Make a :class:`PIL.Image` and put it in the supplied canvas.
:param purpose: A string describing the purpose of the image. This is
used for both logging and also when persisting the image so that TK
doesn't garbage collect it.
:param dimensions: An iterable pair - (width, height).
:param canvas: The :class:`tkinter.Canvas` where the image will be
displayed.
"""
image = self.getImageObject(dimensions, purpose)
if image is not None:
photoImage = ImageTk.PhotoImage(image)
self.images[purpose].append(photoImage)
canvas.create_image(0, 0, image=photoImage, anchor="nw")
canvas.config(scrollregion=canvas.bbox(TK.ALL))
评论列表
文章目录