tooltip(n)
π tooltip(n) β Tooltip management
okay bestie, welcome to tooltip(n), the Tooltip management page β¨ this is the manual page from the tooltip package β yes, that's the manual name right there, tooltip(n), we're not hiding it π
β¨ SYNOPSIS β¨
package require Tcl 8.4
package require msgcat 1.3
package require tooltip ?1.4.6?
::tooltip::tooltip command ?options?
::tooltip::tooltip pathName ?option arg? message
πΈ DESCRIPTION πΈ
so this package literally gives you tooltips π«Ά β those tiny text messages that pop up when your mouse hovers over a widget, a menu item, a canvas item, a listbox item, or a text widget tag. that's it. that's the whole vibe. iconic behavior honestly π
π COMMANDS π
::tooltip::tooltip command ?options?
this one manages the whole tooltip package for you, using these subcommands π
clear indexβ stops the specified widgets from showing tooltips.patternis a glob pattern and defaults to matching all widgets. (yes, the argument is calledindexup top andpatternin the description β that's just how it is, i don't make the rules π)delay ?millisecs?β query or set the hover delay. this is the interval the pointer has to stay over the widget before the tooltip shows up β³ the delay is in milliseconds and must be greater than 50ms. call it with no argument and you get the current delay back.fade ?boolean?β turn fading of the tooltip on or off. it's enabled by default on Win32 and Aqua π the tooltip will fade away on Leave events instead of just disappearing. cute.disableoffβ disable all tooltips πenableonβ enables tooltips for defined widgets β
::tooltip::tooltip pathName ?option arg? message
this command arranges for the widget pathName to display a tooltip with the message message π
the tooltip uses a late-binding msgcat call on the message you pass in, so your app can switch languages on the fly, no cap πβ¨
if the widget you specify is a menu, canvas or text widget, then extra options get used to tie the tooltip to specific menu entries, canvas items, or text tags:
-index indexβ sets a tooltip on a menu item π the index can be either the entry index or the entry label. the widget must be a menu widget, but the entries don't have to exist yet when you set the tooltip (they can show up later, no stress).-items nameβ sets a tooltip for canvas widget or listbox items π¨ for the canvas widget, the item must already be in the canvas widget and will be found with afind withtaglookup. for listbox widgets the item(s) may be created later, but you (the programmer, the main character π) are responsible for managing the link between the listbox item index and the corresponding tooltip. if the listbox items get re-ordered, the tooltips will need amending π
heads up: if the widget is not a canvas or listbox, an error is raised π
-tag nameβ the-tagoption sets a tooltip for a text widget tag π·οΈ the tag should already be present when this command is called or an error will be returned. the widget must also be a text widget.--β the--option marks the end of options π the argument right after it will be treated asmessageeven if it starts with a-.
β EXAMPLE β
fr fr just look at these, they ate π₯
# Demonstrate widget tooltip
package require tooltip
pack [label .l -text "label"]
tooltip::tooltip .l "This is a label widget"
# Demonstrate menu tooltip
package require tooltip
. configure -menu [menu .menu]
.menu add cascade -label Test -menu [menu .menu.test -tearoff 0]
.menu.test add command -label Tooltip
tooltip::tooltip .menu.test -index 0 "This is a menu tooltip"
# Demonstrate canvas item tooltip
package require tooltip
pack [canvas .c]
set item [.c create rectangle 10 10 80 80]
tooltip::tooltip .c -item $item "Canvas item tooltip"
# Demonstrate listbox item tooltip
package require tooltip
pack [listbox .lb]
.lb insert 0 "item one"
tooltip::tooltip .lb -item 0 "Listbox item tooltip"
# Demonstrate text tag tooltip
package require tooltip
pack [text .txt]
.txt tag configure TIP-1 -underline 1
tooltip::tooltip .txt -tag TIP-1 "tooltip one text"
.txt insert end "An example of a " {} "tooltip" TIP-1 " tag.\n" {}
π«Ά BUGS, IDEAS, FEEDBACK π«Ά
ngl, this document β and the package it describes β will undoubtedly contain bugs and other problems π that's just the deal.
please report them in the category tooltip of the Tklib Trackers at http://core.tcl.tk/tklib/reportlist π and please also send in any ideas you have for enhancements to either the package and/or the documentation, bestie, we're listening π
π KEYWORDS π
balloon, help, hover, tooltip πΈ
π COPYRIGHT π
Copyright (c) 1996-2008, Jeffrey Hobbs
that's the whole page, bestie β go forth and hover π
β¨ sign-off time: this manual page comes from tklib, version 1.4.6, and the header puts it under the manual name tooltip(n) π¦ periodt π
π¦ where this page comes from
- alpine 3.24: tk-lib-doc 0.7-r0 Β· TCL
- Copyright (c) 1996-2008, Jeffrey Hobbs
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms