ztk::tooltip
Sets, reads, or removes the text that shows below a widget when the pointer rests on it.
Synopsis
ztk::tooltip PATH ?TEXT?
Arguments
| Name | Type | Default | Meaning |
|---|---|---|---|
PATH |
widget path | The widget. | |
TEXT |
text | The text of the tooltip. An empty text removes the tooltip. With no text, the command gives the current text. |
The tooltip shows 600 ms after the pointer stops on the widget, and fades in and out. A stylesheet sets its look with the part ::tooltip. The tooltip goes away with its widget.
Return value
With TEXT, an empty string. With no TEXT, the text of the tooltip, or an empty string when the widget has none.
Errors
| Error | When |
|---|---|
bad window path name "W" |
No widget has the name. |
wrong # args: should be "ztk::tooltip window ?text?" |
No path, or more than two words. |
Platforms
| Platform | Works |
|---|---|
| Windows | Yes |
| macOS | Yes |
| Linux, Wayland | Yes |
| Linux, X11 | Yes |
| Web | Yes |
| iOS, Android | Yes. The tooltip shows only for a pointer that rests on the widget. |
| Headless | Yes |
Example
button .save -text Save
pack .save -padx 20 -pady 20
ztk::tooltip .save "Saves the document"
ztk::tooltip .save