OSDN Git Service

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