canvas::tag(3tk)
π canvas::tag β bestie edition π
okay so this is the manual page for canvas::tag(3tk), from section 3tk of the manual, and it's literally all about making tag management on canvas items (or item groups) not a whole entire struggle. π
β¨ NAME β¨
canvas::tag β easier management of the tags on canvas items or item groups π¦
πΈ SYNOPSIS πΈ
package require Tcl 8.5
package require Tk 8.5
package require canvas::tag ?0.1?
::canvas::tag append canvas tagOrId tag...
::canvas::tag prepend canvas tagOrId tag...
::canvas::tag append canvas tagOrId index tag...
::canvas::tag remove canvas tagOrId tag...
::canvas::tag match canvas tagOrId pattern
π DESCRIPTION π
so this package hands you a lil set of utility commands for managing the tag lists that live on canvas items or item groups. way easier than doing it yourself, fr fr.
the whole problem with the existing canvas API is that a tag list can only be set as a whole, which makes adding and removing tags from those lists a whole production: you have to read the current tag list, modify it, and then write the changed list back. exhausting. π
and the commands in this package? they hide all of that complexity from you. you're welcome bestie π«Ά
π API π
::canvas::tag append canvas tagOrId tag...β this one adds the tagstag...to the tag list for the items identified by thetagOrIdin thecanvaswidget. the new tags get added at the end of the list. and the result of the command? the empty string. that's it, that's the whole vibe. β¨::canvas::tag prepend canvas tagOrId tag...β this one also adds the tagstag...to the tag list for the items identified by thetagOrIdin thecanvaswidget, except the new tags get added at the beginning of the list. main character energy, always first in line π
and yep β the result of the command is the empty string.
::canvas::tag append canvas tagOrId index tag...β this is the fancy version of append, okay? it adds the tagstag...to the tag list for the items identified by thetagOrIdin thecanvaswidget, and the new tags get inserted before the element atindex.
so like:
index0refers to the beginning of the list.indexendrefers to after the end of the list.
the result of the command is the empty string. (yes, again. consistency icon.)
::canvas::tag remove canvas tagOrId tag...β this one removes the named tagstag...from the tag list for the items identified by thetagOrIdin thecanvaswidget. bye bestie π not me deleting tags with zero guilt.
the result of the command is the empty string.
::canvas::tag match canvas tagOrId patternβ this one finds all the tags for the items identified by thetagOrIdin thecanvaswidget which match the globpattern. π
the result of the command is a list of the matching tags. which may be empty. (empty list is still a valid list, we don't judge π₯²)
π BUGS, IDEAS, FEEDBACK π
real talk: this document, and the package it describes, will undoubtedly contain bugs and other problems. nobody's perfect, not even this page. π
please report such things in the category canvas of the Tklib Trackers: http://core.tcl.tk/tklib/reportlist
and please also report any ideas for enhancements you may have for either the package and/or the documentation. we want the glow-up, and we want it documented. β¨
β KEYWORDS β
append tag, canvas, insert tag, remove tag, tags
okay that's the whole page, you ate that π this was tklib version 0.1, dated with the canvas::tag(3tk) footer energy, and honestly? iconic. periodt. πβ¨π¦
π¦ where this page comes from
- debian trixie: tklib 0.9-1
- ubuntu questing: tklib 0.9-1
- ubuntu resolute: tklib 0.9-1build1
- ubuntu stonking: tklib 0.9-1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms