本文整理汇总了Python中tkinter.ttk.Progressbar方法的典型用法代码示例。如果您正苦于以下问题:Python ttk.Progressbar方法的具体用法?Python ttk.Progressbar怎么用?Python ttk.Progressbar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.ttk
的用法示例。
在下文中一共展示了ttk.Progressbar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_widgets
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def build_widgets(self):
style = ttk.Style()
style.configure('Horizontal.TProgressbar', background='#5eba21')
self.progress = ttk.Progressbar(self, mode='indeterminate', maximum=50)
self.progress.grid(row=0, columnspan=2, sticky=tk.W+tk.E)
self.progress.start(30)
self.lbl_look = ttk.Label(self, text="Looking for Device...")
self.lbl_look.grid(row=1, column=0, columnspan=2, pady=8)
self.btn_open = ttk.Button(self, text="Select Payload", command=self.btn_open_pressed)
self.btn_open.grid(row=2, column=0, padx=8)
self.lbl_file = ttk.Label(self, text="No Payload Selected. ", justify=tk.LEFT)
self.lbl_file.grid(row=2, column=1, padx=8)
self.btn_send = ttk.Button(self, text="Send Payload!", command=self.btn_send_pressed)
self.btn_send.grid(row=3, column=0, columnspan=2, sticky=tk.W+tk.E, pady=8, padx=8)
self.btn_send.state(('disabled',)) # trailing comma to define single element tuple
self.btn_mountusb = ttk.Button(self, text="Mount SD on PC", command=self.btn_mountusb_pressed)
self.btn_mountusb.grid(row=4, column=0, columnspan=2, sticky=tk.W+tk.E, pady=8, padx=8)
self.btn_mountusb.state(('disabled',)) # trailing comma to define single element tuple
示例2: __init__
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def __init__(self, master):
super().__init__(master, text="Levels", padding=4)
self.lowest_level = Player.levelmeter_lowest
self.pbvar_left = tk.IntVar()
self.pbvar_right = tk.IntVar()
pbstyle = ttk.Style()
# pbstyle.theme_use("classic") # clam, alt, default, classic
pbstyle.configure("green.Vertical.TProgressbar", troughcolor="gray", background="light green")
pbstyle.configure("yellow.Vertical.TProgressbar", troughcolor="gray", background="yellow")
pbstyle.configure("red.Vertical.TProgressbar", troughcolor="gray", background="orange")
ttk.Label(self, text="dB").pack(side=tkinter.TOP)
frame = ttk.LabelFrame(self, text="L.")
frame.pack(side=tk.LEFT)
self.pb_left = ttk.Progressbar(frame, orient=tk.VERTICAL, length=200, maximum=-self.lowest_level,
variable=self.pbvar_left, mode='determinate',
style='yellow.Vertical.TProgressbar')
self.pb_left.pack()
frame = ttk.LabelFrame(self, text="R.")
frame.pack(side=tk.LEFT)
self.pb_right = ttk.Progressbar(frame, orient=tk.VERTICAL, length=200, maximum=-self.lowest_level,
variable=self.pbvar_right, mode='determinate',
style='yellow.Vertical.TProgressbar')
self.pb_right.pack()
示例3: _progress_bar
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def _progress_bar(self):
""" Place progress bar into right of the status bar. """
progressframe = ttk.Frame(self)
progressframe.pack(side=tk.RIGHT, anchor=tk.E, fill=tk.X)
lblmessage = ttk.Label(progressframe, textvariable=self._pbar_message)
lblmessage.pack(side=tk.LEFT, padx=3, fill=tk.X, expand=True)
pbar = ttk.Progressbar(progressframe,
length=200,
variable=self._pbar_position,
maximum=100,
mode="determinate")
pbar.pack(side=tk.LEFT, padx=2, fill=tk.X, expand=True)
pbar.pack_forget()
return pbar
示例4: _add_busy_indicator
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def _add_busy_indicator(self, parent):
""" Place progress bar into bottom bar to indicate when processing.
Parameters
----------
parent: tkinter object
The tkinter object that holds the busy indicator
Returns
-------
ttk.Progressbar
A Progress bar to indicate that the Preview tool is busy
"""
logger.debug("Placing busy indicator")
pbar = ttk.Progressbar(parent, mode="indeterminate")
pbar.pack(side=tk.LEFT)
pbar.pack_forget()
self._busy_tkvar.trace("w", self._busy_indicator_trace)
return pbar
示例5: initialize_statusframe
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def initialize_statusframe(self):
"""
Initialize the frame and statusbar occupying the bottom
"""
frame = self.bottompart
frame.pb = ttk.Progressbar(frame,
orient='horizontal',
mode='determinate',
maximum=100)
frame.pb.pack(fill='both',expand=True,side='top')
frame.lab = Tkinter.Label(frame,text=u"Awaiting input options")
frame.lab.pack(in_=frame.pb,expand=True)
#sys.stdout = StdoutToLabel(frame.lab, progressbar=frame.pb)
sys.stdout = StdoutToLabel(frame.lab,
progressbar=frame.pb,
width=frame.cget('width'))
示例6: __init__
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def __init__(self, parent: tk.Tk, maximum: int):
self.maximum = maximum
self.value = 0
self.parent = parent
pack_opts = {
"fill": tk.X,
"expand": 1,
"padx": XPADDING,
"pady": YPADDING
}
self.status_text = tk.StringVar(parent)
pack(ttk.Label(parent, textvariable=self.status_text, width=45),
**pack_opts)
self.progress_bar = pack(
ttk.Progressbar(parent, maximum=maximum, mode="determinate"),
**pack_opts)
self.close_when_changes = tk.IntVar(parent, name="Ready to Close")
示例7: __init__
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def __init__(self, master):
ttk.Label(master, text = "PROGRESS CONTROL").pack()
# Inderterminant Progressbar
ttk.Label(master, text = 'Inderterminant Progress').pack()
self.prgrsbr_indtr = ttk.Progressbar(master, orient = tk.HORIZONTAL, length = 300, mode = 'indeterminate')
self.prgrsbr_indtr.pack()
self.checkpbi = tk.StringVar()
self.checkpbi.set("Start")
# Button
self.btn1 = ttk.Button(master, text = "{} Inderterminant Progress Bar".format(self.checkpbi.get()), command = self.btn1cmd)
self.btn1.pack()
# Derterminant progress
ttk.Label(master, text = 'Derterminant Progress').pack()
self.prgrsbr_dtr = ttk.Progressbar(master, orient=tk.HORIZONTAL, length = 300, mode = 'determinate')
self.prgrsbr_dtr.pack()
self.prgrsbr_dtr.config(maximum = 10.0, value = 2.0) # notice both these properties have float values
# Button
ttk.Button(master, text = 'Reset Progress Bar to zero', command = self.resetProgressBarVal).pack()
# Button
ttk.Button(master, text = 'Increase Progress Bar by 2', command = self.shift2ProgressBarVal).pack()
# create double variable
self.prgrsBrVal = tk.DoubleVar()
self.prgrsbr_dtr.config(variable = self.prgrsBrVal) # set variable property of progressbar to look at DoubleVar()
# Scale widget
self.scalebar = ttk.Scale(master, orient = tk.HORIZONTAL, length = 400, variable=self.prgrsBrVal, from_ = 0.0, to= 10.0)
self.scalebar.pack()
# Label to display current value of scalebar
ttk.Label(master, text = "Current value of Progress Bar is as below:").pack()
self.scalebar_label = ttk.Label(master, textvariable = self.prgrsBrVal)
self.scalebar_label.pack()
示例8: start_progress_bar
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def start_progress_bar(self, path):
'''Pop up a progress bar starting at 0% while the wordlist is processing
'''
self.progress_path = path
self.progress_popup = Tk.Toplevel()
self.progress_popup.title('Processing')
self.progress_popup.resizable(width=False, height=False)
self.progress_popup.grab_set()
self.progress_popup.overrideredirect(1)
progress_frame = Tk.Frame(self.progress_popup, borderwidth=1, relief=Tk.RAISED)
progress_frame.pack(side='top', fill='both', padx=10, pady=10)
path_label = Tk.Label(progress_frame, text='', font=('Helvetica', '12'))
path_label.pack(padx=10, pady=10)
path_label.configure(text="Processing to '{}'...".format(path))
self.progress_var = Tk.DoubleVar()
self.progress_bar = ttk.Progressbar(progress_frame, variable=self.progress_var,
length=300, maximum=100, style='plain.Horizontal.TProgressbar')
self.progress_bar.pack(side='left', padx=10, pady=10)
self.progress_percent_lb = Tk.Label(progress_frame, text='', font=('Helvetica', '12'))
self.progress_percent_lb.pack(side='left', padx=10, pady=10)
self.progress_percent_lb.configure(text='0%')
def stop(): self.controller.stop_processing_flag = True
self.progress_btn = Tk.Button(progress_frame, text='Cancel', command=stop)
self.progress_btn.pack(side='left', padx=10, pady=20)
center_window(self.progress_popup, self.master)
self.progress_popup.update()
示例9: songnamee
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def songnamee():
frame1 = Frame(root, borderwidth=2, relief='ridge')
frame2 = Frame(root, borderwidth=2, relief='ridge')
frame3 = Frame(root, borderwidth=2, relief='ridge')
frame4 = Frame(root, borderwidth=0, relief='ridge')
frame5 = Frame(root, borderwidth=0, relief='ridge')
frame6 = Frame(root, borderwidth=0, relief='ridge')
frame1.grid(column=0, row=0, sticky="nsew")
frame2.grid(column=0, row=1, sticky="nsew")
frame3.grid(column=0, row=2, sticky="nsew")
frame4.grid(column=1, row=0, sticky="nsew")
frame5.grid(column=2, row=0, sticky="nsew")
frame6.grid(column=2, row=1, sticky="nsew")
menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
menu.add_cascade(label='Download Type', menu=filemenu)
filemenu.add_command(label='Song Name', command=songnamee)
filemenu.add_command(label='Youtube Link', command=youtubelink)
filemenu.add_command(label='File', command=file)
home = Button(frame1, text="HOME",width=15, command=songnamee)
playlist = Button(frame2, text="PLAYLIST",width=15, command=playlistbackground)
about = Button(frame3, text="ABOUT",width=15, command=aboutbackground)
songName = Entry(frame4, width=40)
download = Button(frame5, text="Download", command=lambda: downloadname(songName))
progress = ttk.Progressbar(frame6,orient ="horizontal",length = 200, mode ="determinate")
home.pack(fill='x')
playlist.pack(fill='x')
about.pack(fill='x')
songName.pack()
download.pack()
progress.pack()
root.mainloop()
# Function for youtube link button
示例10: __init__
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def __init__(self, parent, **kwargs):
super().__init__(parent)
self._status = tk.IntVar(self)
self._bar = ttk.Progressbar(parent, variable=self._status, **kwargs)
示例11: create_widgets
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def create_widgets(self):
''' Creates all widgets that belong to this frame.
'''
self.parent.title('pyDEA')
self.pack(fill=BOTH, expand=1)
self.columnconfigure(0, weight=1, pad=5)
self.columnconfigure(1, weight=0, pad=5)
self.rowconfigure(0, pad=3, weight=1)
self.rowconfigure(1, pad=3)
self.rowconfigure(2, pad=3)
self.rowconfigure(3, pad=3)
self.current_categories = []
data_from_params_file = StringVar()
str_var_for_input_output_boxes = ObserverStringVar()
self.params_frame = ParamsFrame(self, self.current_categories,
data_from_params_file,
str_var_for_input_output_boxes,
self.weights_status_str)
data_frame = DataFrame(self, self.params_frame, self.current_categories,
data_from_params_file,
str_var_for_input_output_boxes)
self.data_frame = data_frame
data_frame.grid(row=0, column=0, sticky=N+S+W+E, padx=15, pady=15)
self.params_frame.grid(row=0, column=1, sticky=W+E+S+N, padx=15,
pady=15, columnspan=2)
lbl_progress = Label(self, text='Progress')
lbl_progress.grid(row=1, column=0, sticky=W, padx=10, pady=5)
self.progress_bar = Progressbar(self, mode='determinate', maximum=100)
self.progress_bar.grid(row=2, column=0, sticky=W+E, padx=10, pady=5)
run_btn = Button(self, text='Run', command=self.run)
run_btn.grid(row=2, column=1, sticky=W, padx=10, pady=10)
self.weights_status_lbl = Label(self, text='', foreground='red')
self.weights_status_lbl.grid(row=2, column=2, padx=10, pady=5, sticky=W)
示例12: create_widgets
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def create_widgets(self):
''' Creates appropriate widgets on this frame.
'''
self.columnconfigure(0, weight=1)
self.rowconfigure(3, weight=1)
frame_for_save_btn = Frame(self)
frame_for_save_btn.columnconfigure(1, weight=1)
self.status_lbl = Label(frame_for_save_btn, text='')
self.status_lbl.grid(row=0, column=1, sticky=N+W)
save_solution_btn = Button(frame_for_save_btn, text='Save solution',
command=self.on_save_solution)
save_solution_btn.grid(row=1, column=0, sticky=W+N, padx=5, pady=5)
self.progress_bar = Progressbar(frame_for_save_btn,
mode='determinate', maximum=100)
self.progress_bar.grid(row=1, column=1, sticky=W+E, padx=10, pady=5)
frame_for_save_btn.grid(sticky=W+N+E+S, padx=5, pady=5)
frame_for_btns = Frame(self)
self._create_file_format_btn('*.xlsx', 1, frame_for_btns, 0)
self._create_file_format_btn('*.xls', 2, frame_for_btns, 1)
self._create_file_format_btn('*.csv', 3, frame_for_btns, 2)
self.solution_format_var.set(1)
frame_for_btns.grid(row=1, column=0, sticky=W+N+E+S, padx=5, pady=5)
self.data_from_file_lbl = Label(self, text=TEXT_FOR_FILE_LBL, anchor=W,
justify=LEFT,
wraplength=MAX_FILE_PARAMS_LBL_LENGTH)
self.data_from_file_lbl.grid(row=2, column=0, padx=5, pady=5,
sticky=W+N)
self.solution_tab = SolutionFrameWithText(self)
self.solution_tab.grid(row=3, column=0, sticky=W+E+S+N, padx=5, pady=5)
示例13: __init__
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def __init__(self, parent):
super().__init__(parent)
self.progress_bar = Progressbar(self, mode='determinate', maximum=100)
示例14: init_gui
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def init_gui(self):
root = self.root = tki.Tk()
root.title("IB History Downloader")
root.minsize(280, root.winfo_height())
root.resizable(True, False)
self.path = Path(root, 0, 'Output dir', './')
self.file = FileName(root, 1, 'Output file', '')
self.symbol = LabelEntry(root, 2, 'Symbol', '', self._onParamChange)
self.endDate = LabelEntry(root, 3, 'End Date [Time]', '', self._onParamChange)
self.duration = Duration(root, 4, 'Duration', self._onParamChange)
self.barSize = BarSize(root, 5, 'Bar size', self._onParamChange)
self.barType = BarType(root, 6, 'Data Type', self._onParamChange)
self.save = ttk.Button(root, text='Save', command=self.onSave)
self.save.grid(row=7, column=1, sticky=tki.NSEW)
self.quit = ttk.Button(root, text='Quit', command=self.onQuit)
self.quit.grid(row=7, column=2, sticky=tki.NSEW)
var = tki.IntVar()
self.prgrs = ttk.Progressbar(root, mode='determinate', orient=tki.HORIZONTAL, variable=var)
self.prgrs.var = var
self.prgrs.grid(row=8, column=0, columnspan=3, sticky=tki.NSEW)
var.set(0)
self._onParamChange()
root.columnconfigure(0, weight=0)
root.columnconfigure(1, weight=1)
root.columnconfigure(2, weight=0)
root.protocol("WM_DELETE_WINDOW", self.onQuit)
self.checkMsgFromTws()
示例15: create
# 需要导入模块: from tkinter import ttk [as 别名]
# 或者: from tkinter.ttk import Progressbar [as 别名]
def create(self, **kwargs):
return ttk.Progressbar(self.root, **kwargs)