Skip to content
Advertisement

Python Tkinter How to get the image of the Canvas?

As the title says, I need to get the image of a canvas

To get the image of a Label, I simply type

JavaScript

I can check to see if AmImage is in aLabel using cget() so how do I do the same with the Canvas? cget("image") doesn’t seem to work

Advertisement

Answer

I Found a way to do it, So I will try to explain it

JavaScript

A Tag is a name to certain parts of a widget like the Canvas. "abc" is the name of the tag of the image that got created, you can name it however you want, the tag cannot contain spaces and it must be a string tag = "your_string".

Image example

The reason we need to add a tag to the item is this

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement