canvas::tag(3tk)

πŸ“¦
version 0.9 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 tags tag... to the tag list for the items identified by the tagOrId in the canvas widget. 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 tags tag... to the tag list for the items identified by the tagOrId in the canvas widget, 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 tags tag... to the tag list for the items identified by the tagOrId in the canvas widget, and the new tags get inserted before the element at index.

so like:

  • index 0 refers to the beginning of the list.
  • index end refers 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 tags tag... from the tag list for the items identified by the tagOrId in the canvas widget. 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 the tagOrId in the canvas widget which match the glob pattern. πŸ”

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