1Tk::ProgressBar(3)           perl/Tk Documentation          Tk::ProgressBar(3)
2
3
4

NAME

6       Tk::ProgressBar - A graphical progress bar
7

SYNOPSIS

9           use Tk::ProgressBar;
10
11           $progress = $parent->ProgressBar(
12               -width => 200,
13               -length => 20,
14               -anchor => 's',
15               -from => 0,
16               -to => 100,
17               -blocks => 10,
18               -colors => [0, 'green', 50, 'yellow' , 80, 'red'],
19               -variable => \$percent_done
20           );
21
22           $progress->value($position);
23

DESCRIPTION

25       Tk::ProgressBar provides a widget which will show a graphical represen‐
26       tation of a value, given maximum and minimum reference values.
27

STANDARD OPTIONS

29       The following standard widget options are supported:
30
31       -borderwidth
32       -highlightthickness
33           Defaults to 0.
34
35       -padx
36           Defaults to 0.
37
38       -pady
39           Defaults to 0.
40
41       -relief
42           Defaults to "sunken"
43
44       -troughcolor
45           The color to be used for the background (trough) of the progress
46           bar.  Default is to use grey55.
47

WIDGET-SPECIFIC OPTIONS

49       -anchor
50           This can be used to position the start point of the bar. Default is
51           'w' (horizontal bar starting from the left). A vertical bar can be
52           configured by using either 's' or 'n'.
53
54       -blocks
55           This controls the number of blocks to be used to construct the
56           progress bar. The default is to break the bar into 10 blocks.
57
58       -colors
59           Controls the colors to be used for different positions of the
60           progress bar.  The colors should be supplied as a reference to an
61           array containing pairs of positions and colors.
62
63             -colors => [ 0, 'green', 50, 'red' ]
64
65           means that for the range 0 to 50 the progress bar should be green
66           and for higher values it should be red.
67
68       -from
69           This sets the lower limit of the progress bar.  If the bar is set
70           to a value below the lower limt no bar will be displayed. Defaults
71           to 0.  See the "-to" description for more information.
72
73       -gap
74           This is the spacing (in pixels) between each block. Defaults to 1.
75           Use 0 to get a continuous bar.
76
77       -length
78           Specifies the desired long dimension of the ProgressBar in screen
79           units (i.e. any of the forms acceptable to Tk_GetPixels). For ver‐
80           tical ProgressBars this is the ProgressBars height; for horizontal
81           scales it is the ProgressBars width.  The default length is calcu‐
82           lated from the values of "-padx", "-borderwidth", "-highlightthick‐
83           ness" and the difference between "-from" and "-to".
84
85       -resolution
86           A real value specifying the resolution for the scale. If this value
87           is greater than zero then the scale's value will always be rounded
88           to an even multiple of this value, as will tick marks and the end‐
89           points of the scale. If the value is less than zero then no round‐
90           ing occurs. Defaults to 1 (i.e., the value will be integral).
91
92       -to This sets the upper limit of the progress bar. If a value is speci‐
93           fied (for example, using the "value" method) that lies above this
94           value the full progress bar will be displayed. Defaults to 100.
95
96       -variable
97           Specifies the reference to a scalar variable to link to the Pro‐
98           gressBar.  Whenever the value of the variable changes, the Pro‐
99           gressBar will upate to reflect this value. (See also the value
100           method below.)
101
102       -value
103           The can be used to set the current position of the progress bar
104           when used in conjunction with the standard "configure". It is usu‐
105           ally recommended to use the value method instead.
106
107       -width
108           Specifies the desired narrow dimension of the ProgressBar in screen
109           units (i.e.  any of the forms acceptable to Tk_GetPixels). For ver‐
110           tical ProgressBars this is the ProgressBars width; for horizontal
111           bars this is the ProgressBars height.  The default width is derived
112           from the values of "-borderwidth" and "-pady" and "-highlightthick‐
113           ness".
114

WIDGET METHODS

116       $ProgressBar->value(?value?)
117           If value is omitted, returns the current value of the ProgressBar.
118           If value is given, the value of the ProgressBar is set. If $value
119           is given but undefined the value of the option -from is used.
120

AUTHOR

122       Graham Barr <gbarr@pobox.com>
123
125       Copyright (c) 1997-1998 Graham Barr. All rights reserved.  This program
126       is free software; you can redistribute it and/or modify it under the
127       same terms as Perl itself.
128
129
130
131Tk804.028                         2008-02-05                Tk::ProgressBar(3)
Impressum