/
usr
/
share
/
tk8.6
/
demos
/
/usr/share/tk8.6/demos
mkdir
upload
Name
Size
Mode
Actions
images/
-
0755
rm
anilabel.tcl
6670
0644
edit
dl
rm
aniwave.tcl
3494
0644
edit
dl
rm
arrow.tcl
7984
0644
edit
dl
rm
bind.tcl
2948
0644
edit
dl
rm
bitmap.tcl
1411
0644
edit
dl
rm
browse
1758
0755
edit
dl
rm
button.tcl
1504
0644
edit
dl
rm
check.tcl
2278
0644
edit
dl
rm
clrpick.tcl
1431
0644
edit
dl
rm
colors.tcl
4995
0644
edit
dl
rm
combo.tcl
1963
0644
edit
dl
rm
cscroll.tcl
3389
0644
edit
dl
rm
ctext.tcl
6019
0644
edit
dl
rm
dialog1.tcl
660
0644
edit
dl
rm
dialog2.tcl
613
0644
edit
dl
rm
en.msg
3867
0644
edit
dl
rm
entry1.tcl
1385
0644
edit
dl
rm
entry2.tcl
2081
0644
edit
dl
rm
entry3.tcl
6104
0644
edit
dl
rm
filebox.tcl
2351
0644
edit
dl
rm
floor.tcl
79108
0644
edit
dl
rm
fontchoose.tcl
1752
0644
edit
dl
rm
form.tcl
1046
0644
edit
dl
rm
goldberg.tcl
56556
0644
edit
dl
rm
hello
512
0755
edit
dl
rm
hscale.tcl
1497
0644
edit
dl
rm
icon.tcl
2063
0644
edit
dl
rm
image1.tcl
1002
0644
edit
dl
rm
image2.tcl
3352
0644
edit
dl
rm
items.tcl
10133
0644
edit
dl
rm
ixset
8068
0755
edit
dl
rm
knightstour.tcl
9140
0644
edit
dl
rm
label.tcl
1379
0644
edit
dl
rm
labelframe.tcl
1847
0644
edit
dl
rm
license.terms
2267
0644
edit
dl
rm
mclist.tcl
4357
0644
edit
dl
rm
menu.tcl
6778
0644
edit
dl
rm
menubu.tcl
4476
0644
edit
dl
rm
msgbox.tcl
1998
0644
edit
dl
rm
nl.msg
6750
0644
edit
dl
rm
paned1.tcl
1110
0644
edit
dl
rm
paned2.tcl
2244
0644
edit
dl
rm
pendulum.tcl
7596
0644
edit
dl
rm
plot.tcl
2758
0644
edit
dl
rm
puzzle.tcl
2596
0644
edit
dl
rm
radio.tcl
2752
0644
edit
dl
rm
README
2082
0644
edit
dl
rm
rmt
5319
0755
edit
dl
rm
rolodex
8300
0755
edit
dl
rm
ruler.tcl
5211
0644
edit
dl
rm
sayings.tcl
2273
0644
edit
dl
rm
search.tcl
4403
0644
edit
dl
rm
spin.tcl
1820
0644
edit
dl
rm
states.tcl
2048
0644
edit
dl
rm
style.tcl
6943
0644
edit
dl
rm
tclIndex
4354
0644
edit
dl
rm
tcolor
11250
0755
edit
dl
rm
text.tcl
4267
0644
edit
dl
rm
textpeer.tcl
2188
0644
edit
dl
rm
timer
1095
0755
edit
dl
rm
toolbar.tcl
3264
0644
edit
dl
rm
tree.tcl
3162
0644
edit
dl
rm
ttkbut.tcl
3405
0644
edit
dl
rm
ttkmenu.tcl
2391
0644
edit
dl
rm
ttknote.tcl
2317
0644
edit
dl
rm
ttkpane.tcl
4172
0644
edit
dl
rm
ttkprogress.tcl
1536
0644
edit
dl
rm
ttkscale.tcl
1420
0644
edit
dl
rm
twind.tcl
11045
0644
edit
dl
rm
unicodeout.tcl
4399
0644
edit
dl
rm
vscale.tcl
1477
0644
edit
dl
rm
widget
23267
0755
edit
dl
rm
Edit:
/usr/share/tk8.6/demos/text.tcl
(4267B)
# text.tcl -- # # This demonstration script creates a text widget that describes # the basic editing functions. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require Tk set w .text catch {destroy $w} toplevel $w wm title $w "Text Demonstration - Basic Facilities" wm iconname $w "text" positionWindow $w ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w {} \ {ttk::button $w.buttons.fontchooser -command fontchooserToggle}] pack $btns -side bottom -fill x text $w.text -yscrollcommand [list $w.scroll set] -setgrid 1 \ -height 30 -undo 1 -autosep 1 ttk::scrollbar $w.scroll -command [list $w.text yview] pack $w.scroll -side right -fill y pack $w.text -expand yes -fill both # TIP 324 Demo: [tk fontchooser] proc fontchooserToggle {} { tk fontchooser [expr {[tk fontchooser configure -visible] ? "hide" : "show"}] } proc fontchooserVisibility {w} { $w configure -text [expr {[tk fontchooser configure -visible] ? "Hide Font Dialog" : "Show Font Dialog"}] } proc fontchooserFocus {w} { tk fontchooser configure -font [$w cget -font] \ -command [list fontchooserFontSel $w] } proc fontchooserFontSel {w font args} { $w configure -font [font actual $font] } tk fontchooser configure -parent $w bind $w.text <FocusIn> [list fontchooserFocus $w.text] fontchooserVisibility $w.buttons.fontchooser bind $w <<TkFontchooserVisibility>> [list \ fontchooserVisibility $w.buttons.fontchooser] focus $w.text $w.text insert 0.0 \ {This window is a text widget. It displays one or more lines of text and allows you to edit the text. Here is a summary of the things you can do to a text widget: 1. Scrolling. Use the scrollbar to adjust the view in the text window. 2. Scanning. Press mouse button 2 in the text window and drag up or down. This will drag the text at high speed to allow you to scan its contents. 3. Insert text. Press mouse button 1 to set the insertion cursor, then type text. What you type will be added to the widget. 4. Select. Press mouse button 1 and drag to select a range of characters. Once you've released the button, you can adjust the selection by pressing button 1 with the shift key down. This will reset the end of the selection nearest the mouse cursor and you can drag that end of the selection by dragging the mouse before releasing the mouse button. You can double-click to select whole words or triple-click to select whole lines. 5. Delete and replace. To delete text, select the characters you'd like to delete and type Backspace or Delete. Alternatively, you can type new text, in which case it will replace the selected text. 6. Copy the selection. To copy the selection into this window, select what you want to copy (either here or in another application), then click button 2 to copy the selection to the point of the mouse cursor. 7. Edit. Text widgets support the standard Motif editing characters plus many Emacs editing characters. Backspace and Control-h erase the character to the left of the insertion cursor. Delete and Control-d erase the character to the right of the insertion cursor. Meta-backspace deletes the word to the left of the insertion cursor, and Meta-d deletes the word to the right of the insertion cursor. Control-k deletes from the insertion cursor to the end of the line, or it deletes the newline character if that is the only thing left on the line. Control-o opens a new line by inserting a newline character to the right of the insertion cursor. Control-t transposes the two characters on either side of the insertion cursor. Control-z undoes the last editing action performed, and } switch [tk windowingsystem] { "aqua" - "x11" { $w.text insert end "Control-Shift-z" } "win32" { $w.text insert end "Control-y" } } $w.text insert end { redoes undone edits. 7. Resize the window. This widget has been configured with the "setGrid" option on, so that if you resize the window it will always resize to an even number of characters high and wide. Also, if you make the window narrow you can see that long lines automatically wrap around onto additional lines so that all the information is always visible.} $w.text mark set insert 0.0
Save
cmd:
run