[iu2] 2009-03-24 This is a calculator application. So, What's the big deal? The way the window's caption is used... I apologize, this is very silly, but at the same time a bit challenging, I think. I don't think this could be more elegant in other languages (of the few I know...) thanks to [after], [trace] and [bind]ing Here it is: ====== package require Tk pack [label .lbl -text "Type a calculation in this odd calculator and press ENTER.\nType 'exit' to exit"] bind . { if {[string is print -strict %A]} { wm title . [regsub {_$} [wm title .] {}]%A } elseif {"%K" eq "BackSpace"} { wm title . [string range [regsub {_$} [wm title .] {}] 0 end-1] } elseif {"%K" in {Enter Return}} { calc } } proc calc {} { if {![catch {expr [regsub {_$} [wm title .] {}]} res]} { wm title . $res } elseif {[wm title .] eq "exit"} { wm title . Bye... after 1000 {destroy .} } } proc blink {} { if {[string index [wm title .] end] eq "_"} { wm title . [string range [wm title .] 0 end-1] } else { wm title . [wm title .]_ } after 250 blink } wm title . _ raise . after 250 blink ====== [Googie] 24 Mar 2009 - It's fan! I imagine application where we go to settings dialog and there is option like ''Edit window title inline'' :) The only ugly behaviour is in case like I have window manager configured to display title in the center of top bar, so blinking cursor causes whole title to be moved a little left and right, left and right, ... ''[FB]: try replacing the space with a non-breaking space (ASCII 160):'' proc blink {} { if {$::caret eq "_"} {set ::caret "\xA0"} {set ::caret "_"} wm title . $::exp$::caret after 250 blink } [slebetman] - The problem is, on my machine (Ubuntu AMD64) the %k value for the Enter key is 36 and for keypad Enter its 104. I replaced the elseif {%k == 13} part in bind . with elseif {[[regexp {Enter|Return} "%K"]]}. Hope you don't mind. [AMucha] The trace is not really needed. There is an update every 250 ms. Most people can wait that long. Another benefit: The program will work with pre 8.5 Tcl/Tk versions that don't know about [apply] yet. I also changed the ::caret to a single space. The numbers jumped with a caret "_" and "". [iu2] Nice to see this program shrinks... Any more ideas? [AMG]: Rewrote to not have any variables, global or local. Everything is stored in the window title. The drawback is this makes it impossible to type underscore, but this isn't a big deal for a calculator program. <> Example