tk(attribtable)

πŸ“¦ version 9.1.0, in nixpkgs unstable

πŸ’– attribtable πŸ’–

okay bestie, this is the tk(attribtable) manual page. We're learning how to create an attribute table used to query and modify arbitrary data attached to any widget. periodt. ✨

πŸŽ€ NAME πŸŽ€

attribtable β€” creates an attribute table, and that table is used to query and modify arbitrary data attached to any widget. that's the whole vibe. πŸ’…

🌸 SYNOPSIS 🌸

tk attribtable tableName

πŸ’« DESCRIPTION πŸ’«

okay so this command creates an attribute table with the name tableName. It's implemented as a hash table, and it's accessible as a command in the namespace of the calling context if it's not fully qualified. It returns the fully qualified name of the command it just created. iconic behavior. 🫢

An attribute table is used to query and modify arbitrary data attached to any widget. These data are commonly called attributes. iykyk. πŸ¦‹

careful, bestie: if an attribute table of the given name already exists, then it is replaced with the new one β€” and all the attributes of all widgets set using the old table instance will be unset. not a drill. πŸ’€

REMARK 1: When the tableName command is deleted (via rename tableName "" or by deleting the containing namespace), all the attributes of all widgets set using this command are automatically unset, and the underlying hash table is deleted. This will free all the memory used by the table. memory cleanup slay. 🧚

REMARK 2: When a widget is destroyed, all of its attributes set by all attribute table commands are automatically unset. This will free all the memory used by the widget's attributes. bye-bye, attribute storage. πŸ“

The command tableName created by this command has the signature

tableName set|get|unset|clear|exists|names|pathnames args

In the description of the supported forms below, pathName specifies a widget whose attributes are being queried or modified via the tableName command. got it? got it. ✨

tableName set pathName name value ?name value ...?

Sets (i.e., adds or updates) the attributes identified by the name arguments to the values given by the value arguments. Returns an empty string. Example:

# Save and then change the button's text
tk attribtable table
table set .btn prevText [.btn cget -text]
.btn configure -text "NewText"

tableName get pathName ?name ?defaultValue??

If name is specified, then returns the corresponding attribute value, or an empty string or defaultValue (if given) if no corresponding value exists. Otherwise returns a list consisting of all attribute names and values of the widget pathName. Example:

# Restore the button's previous text
.btn configure -text [table get .btn prevText]

tableName unset pathName name ?name ...?

Unsets the attributes identified by the name arguments. Returns an empty string. Example:

table unset .btn prevText

tableName clear pathName

Unsets all attributes and removes pathName from the list of those widgets that have attributes set via tableName set. Returns an empty string. Example:

table clear .btn

tableName exists pathName ?name?

If the optional argument is present, then returns 1 if the attribute identified by name exists and 0 otherwise. Without the optional argument, the return value is 1 if the widget pathName has at least one attribute set via tableName set and 0 otherwise. Example:

if [table exists .btn prevText] {
    # Restore the button's previous text
    .btn configure -text [table get .btn prevText]
}

tableName names pathName

Returns a list consisting of all attribute names of the widget pathName. Example:

puts "attribute names for .btn: [table names .btn]"

tableName pathnames

Returns a list consisting of the path names of all widgets that have attributes set via tableName set. Example:

puts "widgets in table: [table pathnames]"

🌈 KEYWORDS 🌈

widget, attribute, attribute table β€” the whole aesthetic. πŸ‘‘


okay that's the page! this one came from source/version 9.1, dated n, and the manual is tk(attribtable). mwah πŸ’‹

πŸ“¦ where this page comes from
  • nixpkgs unstable: tk 9.1.0
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms