home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
dirs
/
tcl_447.lzh
/
TCL
/
tcl.lzh
/
tcl
/
tclprocs
/
hello.tcl
< prev
next >
Wrap
Text File
|
1990-05-03
|
780b
|
33 lines
# this only works if run as a top-level procedure
global hellowin message width height
set hellowin [window open 300 50 300 50 Hello]
if {[string compare $argv ""] != 0} {
set userfont [font open $argv]
display font $userfont
}
set message "Hello, world."
set width [display textwidth $message]
set height [display fontheight]
proc repaint_window {} {
global hellowin width height message
window current $hellowin
window blank $hellowin
display move [expr {([window width $hellowin] - $width) / 2}] [expr {([window height $hellowin] + $height/2) / 2}]
display text $message
}
proc close_window {} {
global hellowin
window close $hellowin
endeventloop
}
repaint_window
windowevent attach newsize repaint_window
windowevent attach closewindow close_window
eventloop