canvas::tag(n)
π canvas::tag(n) β the manual, but make it make sense
okay so this is the canvas::tag(n) page from the Variations on a canvas corner of the world, and honestly? it's a little gem. bestie, if you've ever fought with a canvas tag list, this is your moment. β¨
π NAME π
canvas::tag β literally just easier management of the tags on canvas items or item groups. that's the whole vibe. no cap. π«Ά
β¨ 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
like yes, append shows up twice, that is NOT a typo, it's a different signature, keep reading, i promise it slays π
πΈ DESCRIPTION πΈ
okay so this package hands you a little pile of utility commands so managing the tag lists attached to canvas items (or item groups) is, like, actually pleasant instead of giving you a headache π¦
here's the tea on the existing canvas API: a tag list can only be set as a whole. so if you want to add or remove even one tag, you're doing this whole β¨productionβ¨ where you read the current tag list, modify it, then write the changed list back. so much effort. so much main-character energy spent on bookkeeping π
the commands in this package hide all of that complexity from you. you just say what you want, and it handles the rest. iconic behavior, honestly π
β API β
::canvas::tag append canvas tagOrId tag...β adds the tagstag...to the tag list for the items identified bytagOrIdin thecanvaswidget. and where do they go? at the end of the list, obviously π the result of the command is the empty string.::canvas::tag prepend canvas tagOrId tag...β same idea, adds the tagstag...to the tag list for the items identified bytagOrIdin thecanvaswidget, except these get added at the beginning of the list because someone has to go first π the result of the command is the empty string.::canvas::tag append canvas tagOrId index tag...β yup,appendagain, but with extra spice π this one adds the tagstag...to the tag list for the items identified bytagOrIdin thecanvaswidget, and the new tags are inserted before the element atindex.index0refers to the beginning of the list.indexendrefers to after the end of the list.
the result of the command is the empty string.
::canvas::tag remove canvas tagOrId tag...β this one β¨removesβ¨ the named tagstag...from the tag list for the items identified bytagOrIdin thecanvaswidget. the result of the command is the empty string.::canvas::tag match canvas tagOrId patternβ this one goes hunting π₯ it finds all tags for the items identified bytagOrIdin thecanvaswidget which match the globpattern. the result of the command is a list of the matching tags. which may be empty.
lowkey important: an empty result is a totally valid answer, not an error. don't be dramatic about it π
π BUGS, IDEAS, FEEDBACK π
bestie. this document, and the package it describes, will undoubtedly contain bugs and other problems. that's just how software is. π
so please report such 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. they want to hear it, fr fr π«Ά
π₯ KEYWORDS π₯
append tag, canvas, insert tag, remove tag, tags
and that's the whole page, bestie β no crumbs left behind π
this cute little number is brought to you by tklib, version 0.1, and it covers the canvas::tag(n) manual page β¨ go forth and tag responsibly π
π¦ where this page comes from
- alpine 3.24: tk-lib-doc 0.7-r0 Β· TCL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms