lundi 4 janvier 2021

(Tkinter) How to get the tag to be recognized correctly?

I want to make a code that does something only if the tag of an object matches the characters of interest. What I did was write this:

if str(canvas.gettags(object))=='thistag':
    do_this_thing(object)
else: 
    pass

When I run the code, it seem that the tag never matches. So I print the tag in the condition else and I get this: ('thistag',).

How should I write the tag so that it can be recognized?

Aucun commentaire:

Enregistrer un commentaire