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