I am creating an app using Python Tkinter in which I give the users an option to insert an image into a text widget. I know that when you insert an image, and you don't specify the name
attribute, tkinter automatically generates one. There is also a way to get a tuple of all the name
s in the text widget using the text.image_names()
method. All the methods I have looked at, that relate to text widget images only take the image's index as an attribute. However, I don't know the image's index.
It would be nice if anyone could tell me if there is a method where I give the function the image's name
is an attribute, and get the index in return.
You can use
Text.index()
on the image name to get the image index in"line.column"
format.Below is an example:
You will get
Image with name "img1" is at index 2.15
in the console.