Tk - Progressbar Widget



Progressbar widget is used to provide visual feedback of the progress of a long operation like file upload. The syntax for progressbar widget is shown below −

progressbar progressbarName options

Options

The options available to progressbar widget is listed below in the following table −

Sr.No. Syntax & Description
1

-length number

Sets the length for widget.

2

-maximum number

Set the maximum possible -value. Default is 100.

3

-mode mode

Mode can be indeterminate or determinate.

4

-orien orientation

Sets the orientation for widget. It can be either horizontal or vertical.

5

-value number

The current progress of the progress bar.

6

-variable varName

Variable associated with the widget. When the text of widget changes, the variable is set to text of widget.

A simple example for progressbar widget is shown below.

#!/usr/bin/wish

pack [ttk::progressbar .p1 -orient horizontal -length 200 -mode indeterminate -value 90]
pack [ttk::progressbar .p2 -orient horizontal -length 200 -mode determinate -variable a
   -maximum 75 -value 20]

When we run the above program, we will get the following output.

Progressbar Example
tk_mega_widgets.htm
Advertisements