File: test.tcl

package info (click to toggle)
amsn 0.98.3-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 33,876 kB
  • ctags: 10,292
  • sloc: tcl: 117,923; ansic: 32,173; cpp: 17,387; xml: 6,643; objc: 1,251; sh: 667; makefile: 544; perl: 215; python: 126
file content (58 lines) | stat: -rw-r--r-- 1,463 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env wish

lappend auto_path "../"
package require TkCximage
package require pixmapbutton
source checkbutton.tcl
source radiobutton.tcl

#wm attributes
wm title . "button test"
#wm geometry . 350x100
. config -bg white
update

font create plain -family helvetica -size 12 -weight normal
font create massive -family helvetica -size 32
image create photo icon -file icon.gif
image create photo icon2 -file icon2.gif

pixmapbutton .b1 -text "Buttons can\nhave multiline\ntext!" \
	-foreground red \
	-font massive \
	-command [list puts "b1 clicked"] \
	-activeforeground blue
	
pixmapbutton .b2 -text "Or they can have very long \nstupid text like this..." \
	-font plain \
	-command [list puts "b2 clicked"]
	
pixmapbutton .b3 -text "..or short :)" \
	-anchor w \
	-command [list puts "b3 clicked"]
pixmapbutton .b4 -text "This button invokes every second when you hold it down" \
	-repeatdelay 1000 \
	-repeatinterval 1000 \
	-command [list puts repeat_button]
	
pixmapradiobutton .b5 -text "Disable buttons" \
	-command "disable_all"
pixmapradiobutton .b6 -text "Enable buttons" \
	-command "enable_all"


pack .b1 .b2 .b3 .b4 .b5 .b6 -padx 10 -pady 5 -side top

proc disable_all { } {
	.b1 configure -state disabled
	.b2 configure -state disabled
	.b3 configure -state disabled
	.b4 configure -state disabled
}

proc enable_all { } {
	.b1 configure -state normal
	.b2 configure -state normal
	.b3 configure -state normal
	.b4 configure -state normal
}