Version 6 of A fading window

Updated 2014-10-13 19:20:42 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.


Superlinux - 2014-10-13 19:17:12

OK.. I used Arjen's code above and update it to look as much it can be like it is on Android Toast message. This feature is called on Android a Toast message. if you at the same run made ,for example like 20 messages one after the other, it will fade them all one by one very much like Android's. So here is the updated code. it's a procedure you can call it as much as you like and its message is centered on the screen.

Usage example: