1# From the Tcl Wiki 2 3#------------------------------------------------------ 4# Tkcon isn't packaged in a library, so we have to 5# source the code, but it provides a package, and 6# the commands [tkcon show] and [tkcon hide] 7#------------------------------------------------------ 8 9source lib/tkcon.tcl 10package require tkcon 11 12#------------------------------------------------------ 13# The console doesn't exist yet. If we create it 14# with show/hide, then it flashes on the screen. 15# So we cheat, and call tkcon internals to create 16# the console and customize it to our application. 17#------------------------------------------------------ 18 19set tkcon::PRIV(showOnStartup) 0 20set tkcon::PRIV(root) .console 21set tkcon::PRIV(protocol) {tkcon hide} 22set tkcon::OPT(exec) "" 23tkcon::Init 24tkcon title "JStrack Console" 25 26wm protocol .console WM_DELETE_WINDOW { set tkcon_up 0 ; tkcon hide } 27set tkcon_up 0 28tkcon hide 29 30proc toggle_tkcon {} { 31 if {[winfo ismapped .console]} { 32 catch { tkcon hide } 33 } else { 34 catch { 35 wm geometry .console +200+200 ; tkcon show 36 wm attributes .console -topmost true 37 } 38 } 39} 40 41 42