Add a script to clean up after Tcl/Tk installation
[git/jnareb-git.git] / mingw / lib / tk8.5 / demos / ttkprogress.tcl
blob2db6d59d166beed81ca96d66fb1f9add3966d474
1 # ttkprogress.tcl --
3 # This demonstration script creates several progress bar widgets.
5 # RCS: @(#) $Id: ttkprogress.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
7 if {![info exists widgetDemo]} {
8 error "This script should be run from the \"widget\" demo."
11 package require Tk
12 package require Ttk
14 set w .ttkprogress
15 catch {destroy $w}
16 toplevel $w
17 wm title $w "Progress Bar Demonstration"
18 wm iconname $w "ttkprogress"
19 positionWindow $w
21 ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Below are two progress bars. The top one is a \u201Cdeterminate\u201D progress bar, which is used for showing how far through a defined task the program has got. The bottom one is an \u201Cindeterminate\u201D progress bar, which is used to show that the program is busy but does not know how long for. Both are run here in self-animated mode, which can be turned on and off using the buttons underneath."
22 pack $w.msg -side top -fill x
24 ## See Code / Dismiss buttons
25 set btns [addSeeDismiss $w.buttons $w]
26 pack $btns -side bottom -fill x
28 ttk::frame $w.f
29 pack $w.f -fill both -expand 1
30 set w $w.f
32 proc doBars {op args} {
33 foreach w $args {
34 $w $op
37 ttk::progressbar $w.p1 -mode determinate
38 ttk::progressbar $w.p2 -mode indeterminate
39 ttk::button $w.start -text "Start Progress" -command [list \
40 doBars start $w.p1 $w.p2]
41 ttk::button $w.stop -text "Stop Progress" -command [list \
42 doBars stop $w.p1 $w.p2]
44 grid $w.p1 - -pady 5 -padx 10
45 grid $w.p2 - -pady 5 -padx 10
46 grid $w.start $w.stop -padx 10 -pady 5
47 grid configure $w.start -sticky e
48 grid configure $w.stop -sticky w
49 grid columnconfigure $w all -weight 1