-1
The class PhotoImage
of tkinter
is used to display images in Label
s, Button
s, Canvas
and Text
.
The method _show()
is an internal method of the object Image
; It should not be called directly. A tip for this is that it starts with a _
; is an internal method, a detail of implementation that is called by the PIL itself.
If you are creating a method _show
, is trying to modify the way PIL will display images, but you should not call this method directly.
To finish follow an example of class use PhotoImage
, where an image is inserted inside a text area tkinter.Text
:
img = """
R0lGODlhIAAgAKIFAAAAAACt74xzUsbGxv/3AAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwHoAAAh+QQF
CgAHACwAAAAAIAAgAAADuBi63P4wyrmApbjam+nmkiCK0QdGwqCSj3k+asw2LhXfQrthtww4Ox4u9wp8
KKlVTnFy/VCjZUXjDEkZT6NJm11Ev1PmlssQ9ZRMcY2sSJ4HgqCTE3Sfl88a58vnG9VyfYJRf1xBAYOD
aYBjVyiLho0YeIySSItze5OQkVptmwoEoqIWox9xo6mqAqqmAKakca+tqay0paSztrS1vLgEp7O8oruq
v8AWssPErS6ry6PFuNPCxcO7CQAAIfkEBQYABwAsAQABABcAHQAAA4IYugwOLMr13ryhWiy1i0J4eZIw
DKNGKSc6VV3QRmRDAa7ibTe/qx7XbxgICXS7DIRXPP6QIKNT1YAoQq1BsrowZWtVq7e17UrPgjJ6/Wyu
pUo1J147YoZiDv46p8OKGASCBA6CGmmDiYqFD4ZpAIqRkIWJApGXkxoElpeLhoedBAkAADs=
"""
import tkinter as t
root = t.Tk()
img = t.PhotoImage(data=img)
text = t.Text(root)
text.insert(t.END, "Olá, aqui está a imagem:\n")
text.image_create(t.INSERT, image=img)
text.insert(t.END, " Obrigado!")
text.pack()
root.mainloop()
Always give preference to sharing the code instead of an image, this enables other people to use your code as a basis, makes it easy to point out fixes and adaptations. Also, could you be a little clearer? I really don’t understand what you want.
– Caio de Paula Silva