/usr/share/tk8.6/demos
NameSizeModeActions
images/-0755rm
anilabel.tcl66700644editdlrm
aniwave.tcl34940644editdlrm
arrow.tcl79840644editdlrm
bind.tcl29480644editdlrm
bitmap.tcl14110644editdlrm
browse17580755editdlrm
button.tcl15040644editdlrm
check.tcl22780644editdlrm
clrpick.tcl14310644editdlrm
colors.tcl49950644editdlrm
combo.tcl19630644editdlrm
cscroll.tcl33890644editdlrm
ctext.tcl60190644editdlrm
dialog1.tcl6600644editdlrm
dialog2.tcl6130644editdlrm
en.msg38670644editdlrm
entry1.tcl13850644editdlrm
entry2.tcl20810644editdlrm
entry3.tcl61040644editdlrm
filebox.tcl23510644editdlrm
floor.tcl791080644editdlrm
fontchoose.tcl17520644editdlrm
form.tcl10460644editdlrm
goldberg.tcl565560644editdlrm
hello5120755editdlrm
hscale.tcl14970644editdlrm
icon.tcl20630644editdlrm
image1.tcl10020644editdlrm
image2.tcl33520644editdlrm
items.tcl101330644editdlrm
ixset80680755editdlrm
knightstour.tcl91400644editdlrm
label.tcl13790644editdlrm
labelframe.tcl18470644editdlrm
license.terms22670644editdlrm
mclist.tcl43570644editdlrm
menu.tcl67780644editdlrm
menubu.tcl44760644editdlrm
msgbox.tcl19980644editdlrm
nl.msg67500644editdlrm
paned1.tcl11100644editdlrm
paned2.tcl22440644editdlrm
pendulum.tcl75960644editdlrm
plot.tcl27580644editdlrm
puzzle.tcl25960644editdlrm
radio.tcl27520644editdlrm
README20820644editdlrm
rmt53190755editdlrm
rolodex83000755editdlrm
ruler.tcl52110644editdlrm
sayings.tcl22730644editdlrm
search.tcl44030644editdlrm
spin.tcl18200644editdlrm
states.tcl20480644editdlrm
style.tcl69430644editdlrm
tclIndex43540644editdlrm
tcolor112500755editdlrm
text.tcl42670644editdlrm
textpeer.tcl21880644editdlrm
timer10950755editdlrm
toolbar.tcl32640644editdlrm
tree.tcl31620644editdlrm
ttkbut.tcl34050644editdlrm
ttkmenu.tcl23910644editdlrm
ttknote.tcl23170644editdlrm
ttkpane.tcl41720644editdlrm
ttkprogress.tcl15360644editdlrm
ttkscale.tcl14200644editdlrm
twind.tcl110450644editdlrm
unicodeout.tcl43990644editdlrm
vscale.tcl14770644editdlrm
widget232670755editdlrm
Edit: /usr/share/tk8.6/demos/rmt (5319B)
#!/bin/sh # the next line restarts using wish \ exec wish8.6 "$0" ${1+"$@"} # rmt -- # This script implements a simple remote-control mechanism for # Tk applications. It allows you to select an application and # then type commands to that application. package require Tk wm title . "Tk Remote Controller" wm iconname . "Tk Remote" wm minsize . 1 1 # The global variable below keeps track of the remote application # that we're sending to. If it's an empty string then we execute # the commands locally. set app "local" # The global variable below keeps track of whether we're in the # middle of executing a command entered via the text. set executing 0 # The global variable below keeps track of the last command executed, # so it can be re-executed in response to !! commands. set lastCommand "" # Create menu bar. Arrange to recreate all the information in the # applications sub-menu whenever it is cascaded to. . configure -menu [menu .menu] menu .menu.file menu .menu.file.apps -postcommand fillAppsMenu .menu add cascade -label "File" -underline 0 -menu .menu.file .menu.file add cascade -label "Select Application" -underline 0 \ -menu .menu.file.apps .menu.file add command -label "Quit" -command "destroy ." -underline 0 # Create text window and scrollbar. text .t -yscrollcommand ".s set" -setgrid true scrollbar .s -command ".t yview" grid .t .s -sticky nsew grid rowconfigure . 0 -weight 1 grid columnconfigure . 0 -weight 1 # Create a binding to forward commands to the target application, # plus modify many of the built-in bindings so that only information # in the current command can be deleted (can still set the cursor # earlier in the text and select and insert; just can't delete). bindtags .t {.t Text . all} bind .t { .t mark set insert {end - 1c} .t insert insert \n invoke break } bind .t { catch {.t tag remove sel sel.first promptEnd} if {[.t tag nextrange sel 1.0 end] eq ""} { if {[.t compare insert < promptEnd]} { break } } } bind .t { catch {.t tag remove sel sel.first promptEnd} if {[.t tag nextrange sel 1.0 end] eq ""} { if {[.t compare insert <= promptEnd]} { break } } } bind .t { if {[.t compare insert < promptEnd]} { break } } bind .t { if {[.t compare insert < promptEnd]} { .t mark set insert promptEnd } } bind .t { if {[.t compare insert < promptEnd]} { break } } bind .t { if {[.t compare insert < promptEnd]} { break } } bind .t { if {[.t compare insert <= promptEnd]} { break } } bind .t { if {[.t compare insert <= promptEnd]} { break } } ### This next bit *isn't* nice - DKF ### auto_load tk::TextInsert proc tk::TextInsert {w s} { if {$s eq ""} { return } catch { if { [$w compare sel.first <= insert] && [$w compare sel.last >= insert] } then { $w tag remove sel sel.first promptEnd $w delete sel.first sel.last } } $w insert insert $s $w see insert } .t configure -font {Courier 12} .t tag configure bold -font {Courier 12 bold} # The procedure below is used to print out a prompt at the # insertion point (which should be at the beginning of a line # right now). proc prompt {} { global app .t insert insert "$app: " .t mark set promptEnd {insert} .t mark gravity promptEnd left .t tag add bold {promptEnd linestart} promptEnd } # The procedure below executes a command (it takes everything on the # current line after the prompt and either sends it to the remote # application or executes it locally, depending on "app". proc invoke {} { global app executing lastCommand set cmd [.t get promptEnd insert] incr executing 1 if {[info complete $cmd]} { if {$cmd eq "!!\n"} { set cmd $lastCommand } else { set lastCommand $cmd } if {$app eq "local"} { set result [catch [list uplevel #0 $cmd] msg] } else { set result [catch [list send $app $cmd] msg] } if {$result != 0} { .t insert insert "Error: $msg\n" } elseif {$msg ne ""} { .t insert insert $msg\n } prompt .t mark set promptEnd insert } incr executing -1 .t yview -pickplace insert } # The following procedure is invoked to change the application that # we're talking to. It also updates the prompt for the current # command, unless we're in the middle of executing a command from # the text item (in which case a new prompt is about to be output # so there's no need to change the old one). proc newApp appName { global app executing set app $appName if {!$executing} { .t mark gravity promptEnd right .t delete "promptEnd linestart" promptEnd .t insert promptEnd "$appName: " .t tag add bold "promptEnd linestart" promptEnd .t mark gravity promptEnd left } return } # The procedure below will fill in the applications sub-menu with a list # of all the applications that currently exist. proc fillAppsMenu {} { set m .menu.file.apps catch {$m delete 0 last} foreach i [lsort [winfo interps]] { $m add command -label $i -command [list newApp $i] } $m add command -label local -command {newApp local} } set app [winfo name .] prompt focus .t # Local Variables: # mode: tcl # End: