Update tk to version 8.5.5
[msysgit.git] / mingw / lib / tk8.5 / demos / sayings.tcl
blob091133e1c2f3535fe7934053682261875bc83efe
1 # sayings.tcl --
3 # This demonstration script creates a listbox that can be scrolled
4 # both horizontally and vertically. It displays a collection of
5 # well-known sayings.
7 # RCS: @(#) $Id: sayings.tcl,v 1.6 2007/12/13 15:27:07 dgp Exp $
9 if {![info exists widgetDemo]} {
10 error "This script should be run from the \"widget\" demo."
13 package require Tk
15 set w .sayings
16 catch {destroy $w}
17 toplevel $w
18 wm title $w "Listbox Demonstration (well-known sayings)"
19 wm iconname $w "sayings"
20 positionWindow $w
22 label $w.msg -font $font -wraplength 4i -justify left -text "The listbox below contains a collection of well-known sayings. You can scan the list using either of the scrollbars or by dragging in the listbox window with button 2 pressed."
23 pack $w.msg -side top
25 ## See Code / Dismiss buttons
26 set btns [addSeeDismiss $w.buttons $w]
27 pack $btns -side bottom -fill x
29 frame $w.frame -borderwidth 10
30 pack $w.frame -side top -expand yes -fill both -padx 1c
33 scrollbar $w.frame.yscroll -command "$w.frame.list yview"
34 scrollbar $w.frame.xscroll -orient horizontal \
35 -command "$w.frame.list xview"
36 listbox $w.frame.list -width 20 -height 10 -setgrid 1 \
37 -yscroll "$w.frame.yscroll set" -xscroll "$w.frame.xscroll set"
39 grid $w.frame.list -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
40 grid $w.frame.yscroll -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
41 grid $w.frame.xscroll -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
42 grid rowconfig $w.frame 0 -weight 1 -minsize 0
43 grid columnconfig $w.frame 0 -weight 1 -minsize 0
46 $w.frame.list insert 0 "Don't speculate, measure" "Waste not, want not" "Early to bed and early to rise makes a man healthy, wealthy, and wise" "Ask not what your country can do for you, ask what you can do for your country" "I shall return" "NOT" "A picture is worth a thousand words" "User interfaces are hard to build" "Thou shalt not steal" "A penny for your thoughts" "Fool me once, shame on you; fool me twice, shame on me" "Every cloud has a silver lining" "Where there's smoke there's fire" "It takes one to know one" "Curiosity killed the cat" "Take this job and shove it" "Up a creek without a paddle" "I'm mad as hell and I'm not going to take it any more" "An apple a day keeps the doctor away" "Don't look a gift horse in the mouth" "Measure twice, cut once"