/
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/menubu.tcl
(4476B)
# menubu.tcl -- # # This demonstration script creates a window with a bunch of menus # and cascaded menus using menubuttons. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require Tk set w .menubu catch {destroy $w} toplevel $w wm title $w "Menu Button Demonstration" wm iconname $w "menubutton" positionWindow $w frame $w.body pack $w.body -expand 1 -fill both if {[tk windowingsystem] eq "aqua"} {catch {set origUseCustomMDEF $::tk::mac::useCustomMDEF; set ::tk::mac::useCustomMDEF 1}} menubutton $w.body.below -text "Below" -underline 0 -direction below -menu $w.body.below.m -relief raised menu $w.body.below.m -tearoff 0 $w.body.below.m add command -label "Below menu: first item" -command "puts \"You have selected the first item from the Below menu.\"" $w.body.below.m add command -label "Below menu: second item" -command "puts \"You have selected the second item from the Below menu.\"" grid $w.body.below -row 0 -column 1 -sticky n menubutton $w.body.right -text "Right" -underline 0 -direction right -menu $w.body.right.m -relief raised menu $w.body.right.m -tearoff 0 $w.body.right.m add command -label "Right menu: first item" -command "puts \"You have selected the first item from the Right menu.\"" $w.body.right.m add command -label "Right menu: second item" -command "puts \"You have selected the second item from the Right menu.\"" frame $w.body.center menubutton $w.body.left -text "Left" -underline 0 -direction left -menu $w.body.left.m -relief raised menu $w.body.left.m -tearoff 0 $w.body.left.m add command -label "Left menu: first item" -command "puts \"You have selected the first item from the Left menu.\"" $w.body.left.m add command -label "Left menu: second item" -command "puts \"You have selected the second item from the Left menu.\"" grid $w.body.right -row 1 -column 0 -sticky w grid $w.body.center -row 1 -column 1 -sticky news grid $w.body.left -row 1 -column 2 -sticky e menubutton $w.body.above -text "Above" -underline 0 -direction above -menu $w.body.above.m -relief raised menu $w.body.above.m -tearoff 0 $w.body.above.m add command -label "Above menu: first item" -command "puts \"You have selected the first item from the Above menu.\"" $w.body.above.m add command -label "Above menu: second item" -command "puts \"You have selected the second item from the Above menu.\"" grid $w.body.above -row 2 -column 1 -sticky s ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x set body $w.body.center label $body.label -wraplength 300 -font "Helvetica 14" -justify left -text "This is a demonstration of menubuttons. The \"Below\" menubutton pops its menu below the button; the \"Right\" button pops to the right, etc. There are two option menus directly below this text; one is just a standard menu and the other is a 16-color palette." pack $body.label -side top -padx 25 -pady 25 frame $body.buttons pack $body.buttons -padx 25 -pady 25 tk_optionMenu $body.buttons.options menubuttonoptions one two three pack $body.buttons.options -side left -padx 25 -pady 25 set m [tk_optionMenu $body.buttons.colors paletteColor Black red4 DarkGreen NavyBlue gray75 Red Green Blue gray50 Yellow Cyan Magenta White Brown DarkSeaGreen DarkViolet] if {[tk windowingsystem] eq "aqua"} { set topBorderColor Black set bottomBorderColor Black } else { set topBorderColor gray50 set bottomBorderColor gray75 } for {set i 0} {$i <= [$m index last]} {incr i} { set name [$m entrycget $i -label] image create photo image_$name -height 16 -width 16 image_$name put $topBorderColor -to 0 0 16 1 image_$name put $topBorderColor -to 0 1 1 16 image_$name put $bottomBorderColor -to 0 15 16 16 image_$name put $bottomBorderColor -to 15 1 16 16 image_$name put $name -to 1 1 15 15 image create photo image_${name}_s -height 16 -width 16 image_${name}_s put Black -to 0 0 16 2 image_${name}_s put Black -to 0 2 2 16 image_${name}_s put Black -to 2 14 16 16 image_${name}_s put Black -to 14 2 16 14 image_${name}_s put $name -to 2 2 14 14 $m entryconfigure $i -image image_$name -selectimage image_${name}_s -hidemargin 1 } $m configure -tearoff 1 foreach i {Black gray75 gray50 White} { $m entryconfigure $i -columnbreak 1 } pack $body.buttons.colors -side left -padx 25 -pady 25 if {[tk windowingsystem] eq "aqua"} {catch {set ::tk::mac::useCustomMDEF $origUseCustomMDEF}}
Save
cmd:
run