Tk Source Code

Artifact [6975b599]
Login

Artifact 6975b599ae8afc65d030f01d49217360e8098a36:

Attachment "transparency.tcl" to ticket [1085451f] added by vincentdarley 2004-12-15 05:39:57.

proc fadeIn {{win .startup}} {
    if {![winfo exists $win]} { return }
    set alpha [wm attributes $win -alpha]
    set alpha [expr {$alpha + 0.02}]
    wm attributes $win -alpha $alpha
    if {$alpha < 1.0} {
	after 20 [list ::fadeIn $win]
    }
}

frame .f -width 300 -height 300 -bg red
pack .f -fill both -expand 1
set w .
wm withdraw $w
update idletasks
wm geometry $w +[expr {([winfo screenwidth .]-[winfo reqwidth $w])/2}]+[expr {([winfo screenheight .]-[winfo reqheight $w])/2}]
update
wm attributes $w -alpha 0.0
fadeIn .
wm deiconify $w
raise $w
update