1# ttkprogress.tcl --
2#
3# This demonstration script creates several progress bar widgets.
4#
5# RCS: @(#) $Id$
6
7if {![info exists widgetDemo]} {
8    error "This script should be run from the \"widget\" demo."
9}
10
11package require Tk
12package require Ttk
13
14set w .ttkprogress
15catch {destroy $w}
16toplevel $w
17wm title $w "Progress Bar Demonstration"
18wm iconname $w "ttkprogress"
19positionWindow $w
20
21ttk::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."
22pack $w.msg -side top -fill x
23
24## See Code / Dismiss buttons
25set btns [addSeeDismiss $w.buttons $w]
26pack $btns -side bottom -fill x
27
28ttk::frame $w.f
29pack $w.f -fill both -expand 1
30set w $w.f
31
32proc doBars {op args} {
33    foreach w $args {
34	$w $op
35    }
36}
37ttk::progressbar $w.p1 -mode determinate
38ttk::progressbar $w.p2 -mode indeterminate
39ttk::button $w.start -text "Start Progress" -command [list \
40	doBars start $w.p1 $w.p2]
41ttk::button $w.stop -text "Stop Progress" -command [list \
42	doBars stop $w.p1 $w.p2]
43
44grid $w.p1 - -pady 5 -padx 10
45grid $w.p2 - -pady 5 -padx 10
46grid $w.start $w.stop -padx 10 -pady 5
47grid configure $w.start -sticky e
48grid configure $w.stop -sticky w
49grid columnconfigure $w all -weight 1
50