 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a download progress bar in Tkinter?
Let’s suppose that we are creating an application which interacts with sources and files such as downloading the files, tracking the file. In order to make a progressbar for such an application, we will use the tkinter.ttk package that includes the Progressbar module.
Initially, we will instantiate an object of Progressbar which has orientation of Horizontal. Then, we will define a function to increase the value of the progressbar and keep updating it.
Example
In the following example, we have created a download progress bar by updating its value.
#Import the required libraries from tkinter import * from tkinter.ttk import * import time #Create an instance of tkinter frame win= Tk() #Set the geometry of frame win.geometry("620x400") #Define a function def start():    task=10    x=0    while(x<task):       time.sleep(1)       bar['value']+=10       x+=1       win.update_idletasks() bar= Progressbar(win, orient=HORIZONTAL, length=300) bar.pack(pady=20) #Create a button Button(win, text="Download", command=start).pack(pady=20) win.mainloop()  Output
Running the code will display a download bar and once we click on the “Download” Button, it will automatically get completed.

Advertisements
 