Version 0 of Not balloon help

Updated 2018-05-14 16:24:33 by LEG
Purpose: Embed context sensitive help into a Tcl/Tk application
See also: balloon help
Credits: DKFs answer to a respective question on stack overflow.
Pros: As simple as can be, no external dependencies, no clutter, less distraction
Cons: Always needs space on the GUI, less obvious help for unexperienced users.

Instead of popping up an extra window for tooltip help reserve some space on your GUI for displaying the respective help text. This can be a status line on the bottom of the window. Then update this help text with the <Enter>/<Leave> events of the respective widgets.

Example code:

# a global variable, you might want to put this in a namespace
set help "Hover over any widget to get help for it"

proc help {widget text} {
    # register help text with widget

    bind $widget <Enter> +[list set ::help $text]
    bind $widget <Leave> +[list set ::help ""]
}

# create the help text widget somewhere on your applications top level
# window or in some frame $w

label $w.help -textvariable help -anchor nw 

# register help for the help window itself
help $w.help "Hover over any widget to get help for it"

% in text gets substituted according to bind rules. Use %% to get a simple percent sign.