I. Parameters
parameter | effect |
---|---|
cursor | Shape of the mouse is within the progress bar |
length | The progress bar length |
maximum | The progress bar maximum scale value |
mode | Progress bar mode. There are two types: 'determinate' and 'indeterminate' |
orient | Direction of the progress bar, there are two kinds of HORIZONTAL and VERTICAL |
style | Define the appearance of the progress bar |
takefocus | Can you get the input focus through the Tab |
variable | Variables associated with the progress bar. You can set or get the current value of the progress bar |
value | Get or set the current value of the progress bar |
List of functions:
start(interval=None)
Automatically adjust the position of the progress bar. By starting a timer event loop, the step in accordance with the progress of defined length adjustment position. Timer interval set by the interval parameter. Interval in milliseconds. The default interval is 50 milliseconds.
step(amount=None)
Each time the progress bar to adjust the step size is 1.0 by default
stop()
Stop timer to stop the progress of the automatic adjustment
Second, the sample code
TK Tkinter AS Import from TTK Tkinter Import window tk.Tk = () # Set Window Size winWidth = 600 winHeight = 400 # screen resolution acquired screenWidth = window.winfo_screenwidth () screenHeight = window.winfo_screenheight () X = int ((screenWidth - winWidth) / 2) Y = int ((screenHeight - winHeight) / 2) # set the main window title window.title ( "ProgressBar parameter Description") # initial position settings window centered on screen window.geometry ( "% sx% s + S +% S% "% (winWidth, winHeight, X, Y)) # set window icon window.iconbitmap (" ./ Image / icon.ico ") # setting window width and height fixed window.resizable (0, 0) " " "Progressbar parameter STANDARD the OPTIONS class, the Cursor, style, takefocus WIDGET-SPECIFIC OPTIONS orient, length, mode, maximum, value, variable, phase """ pb = ttk.Progressbar(window, length = 400, value = 0, mode = "indeterminate") pb.pack(pady = 10) def start(): pb.start() tk.Button(window, text="开始", command=start).pack() window.mainloop()
Third, renderings