Progress bar (indeterminate mode)
Progress bar
widget allows you to give feedback to the user about the progress of a
long-running task.The purpose of this widget is to reassure the user
that something is happening.
-->used in loading or downloading types of process.
-->useful to display the status of an operation or task.
-->can indicate the evolution of a certain process(example downloading a file from the Internet).
-->represent that an operation is being executed. Remaining time is unknown.
The progress bar executes in two modes:-
1) Determinate mode
2) Indeterminate mode
Determinate mode
In the determinate mode, the progress bar shows
an indicator from the beginning to the end of the widget. If you know
how to measure relative progress, you can use the determinate mode.
Indeterminate mode:
In the indeterminate mode, the progress bar
shows an indicator that bounces back and forth between the ends of the
widget. you use the indeterminate mode when you don’t know how to
accurately measure the time that the long-running task takes to
complete.
Syntax: Progressbar(container, orient, length, mode)
-->container is parent component of the progress bar.
-->orient can be either 'horizontal' or 'vertical'.
-->length represents the width of a horizontal progress bar
or height of a vertical progress bar.
-->The mode can be either 'determinate' or 'indeterminate'.
Example:
***********Your code Below (Indeterminate mode)********
from tkinter import *
from tkinter import ttk
root = Tk()
root.title("Progress bar indeterminate mode")
root.config(background="#FFF8DC")
root.geometry("700x300+580+86")
lbl= Label(root,text="Progress Bar",font=("Times", 30, "bold"))
lbl.pack(pady=20)
my_progress_bar = ttk.Progressbar(root, orient=HORIZONTAL,length=600, mode='indeterminate')
my_progress_bar.pack(pady=30)
my_progress_bar.start()
root.mainloop()
********End Code**********
Write Down Code Your Code Editor. To show Your Output. If Use Pycharm Press Shift+F10 and Show Your Output.
إرسال تعليق