Updated 2014-10-13 19:22:19 by Superlinux

Arjen Markus (20 april 2013) Here is a little script to create a window that slowly fades and then vanishes. Some e-mail programs (Thunderbird) for instance use this type of window when a new e-mail arrives.

(Note: the fading window appears in the lower-right corner)
# fading.tcl --
#     Create a transient window that slowly fades away
toplevel .fading

wm overrideredirect .fading 1
wm geometry .fading -0-0
raise .fading

pack [label .fading.label -text "Slowly fade away ..."]

tkwait visibility .fading

proc fade {w degree} {
    wm attributes $w -alpha $degree
    if { $degree > 0 } {
        after 200 [list fade $w [expr {$degree-0.05}]]
    } else {
        destroy $w

after 1000 {fade .fading 1.0}

Kevin Walzer: The fading alogrithm is useful for other things also, such as a Cocoa-style popover on Mac.