#!/usr/bin/wish # Name : Tcl/Tk Welcome Message # Author : Terrence Ma # Email : terrence@terrence.com # Web : http://www.terrence.com # Date : 07/16/2001 # License : GNU GPL - http://www.gnu.org/copyleft/gpl.html # Warranty : No Warranty # procedure set message proc setmessage {} { global inname outname time set outname $inname set time [clock format [clock seconds] -format "%r %A %B %d %Y"] } # set frame question, hello, date frame .question -relief groove -borderwidth 2 frame .hello frame .date # set frame question set inname "Computer User" label .question.question -text "Please enter your name : " entry .question.entry -textvariable inname -width 16 -relief sunken bind .question.entry setmessage button .question.button -text Submit -command setmessage # set frame hello, date setmessage label .hello.mess01 -text "Hello" label .hello.name -textvariable outname label .hello.mess02 -text ", welcome to this application !" label .date.mess01 -text "Time is now" label .date.time -textvariable time # draw frames wm title . "Tcl/Tk Welcome Message" pack .question.question .question.entry .question.button -side left pack .hello.mess01 .hello.name .hello.mess02 -side left pack .date.mess01 .date.time -side left pack .question .hello .date -side top focus .question.entry