Python tkinter Progressbar

Basics of Python Tkinter

ttk Progressbar
We can display status of any process by using Progressbar which is part of ttk module.

Tkinter Progressbar to show status with options and methods to manage and display values

Code for a basic Progressbar is here.
import tkinter  as tk 
from tkinter import *
from tkinter import ttk
my_w = tk.Tk()

prg1 = ttk.Progressbar(my_w,orient = HORIZONTAL,
        value=70,length = 300, mode = 'determinate'),rely=.2)    
my_w.mainloop()  # Keep the window open

Progressbar Options

orientOrientation of the Progress bar. Values are Horizontal or Vertical
length Length of the Progress bar, (width if horizontal, height if vertical)
mode Values can be determinate OR indeterminate Check the examples
maximum Default value is 100, specifies the maximum value.
valueThe current value of the Progress bar. Can be set or read.
variableVariable can be linked to value of Progress Bar. Realtime changes ( in values ) can be captured.
Options : value, mode ,orient ,variable etc..

Progressbar Methods

start( interval )increment the Progress bar in every interval value (50 milliseconds default )
step( amount )Default is 1 if omitted, increments in the progress bar value by given amount
stop()Stop the autoincrement mode.

start() step() and stop() Method example

Getting values of all options of Progress bar

We will get a dictionary and by using the keys we can get the set values of the options of the Progress bar.
Here we can set the values of the options also.
print(my_dict['orient']) # print the value of orient
print(my_dict['mode']) # value of mode 

Number of tasks completed

While participating in any online survey you can see one progress bar reflecting the number of questions completed and number of questions balance.

Create one window with six pair of radio buttons where user has to select one choice for each question.

The progress bar will show the progress based on number of Choices made.
Showing progress status based on Selection of Radio buttons
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2022 All rights reserved worldwide Privacy Policy Disclaimer