本文整理匯總了Python中ttk.Progressbar.config方法的典型用法代碼示例。如果您正苦於以下問題:Python Progressbar.config方法的具體用法?Python Progressbar.config怎麽用?Python Progressbar.config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ttk.Progressbar
的用法示例。
在下文中一共展示了Progressbar.config方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Window
# 需要導入模塊: from ttk import Progressbar [as 別名]
# 或者: from ttk.Progressbar import config [as 別名]
class Window(Frame):
def __init__(self, parent):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.parent.title("Network/Port Scan")
self.style = Style()
self.style.configure("TFrame", background = "#000000")
self.style.configure("TCheckbutton", background = "#000000")
self.style.configure("TButton", background = "#000000")
self.pack(fill=BOTH, expand=1)
# Configure layout
self.columnconfigure(0, weight=1)
self.columnconfigure(1, weight=1)
self.columnconfigure(2, weight=1)
self.rowconfigure(5, weight = 1)
self.rowconfigure(6, weight = 1)
# Title of program
lbl = Label(self, text="Network/Port Scan")
lbl.grid(sticky = W, pady=5, padx=5)
# Text Box
area = ScrolledText(self, height = 20)
area.grid(row=1, column=0, columnspan=3, rowspan=4, padx=3, sticky = N+S+E+W)
self.area = area
# IP Address Button
self.ip = BooleanVar()
ip_add_button = Checkbutton(self, text="IP Address",variable=self.ip, width=10)
ip_add_button.grid(row = 1, column = 3, sticky = N)
ip_add_button.config(anchor = W, activebackground = "red")
# Port Button
self.port = BooleanVar()
port_button = Checkbutton(self, text="Ports", variable=self.port, width=10)
port_button.grid(row = 1, column = 3)
port_button.config(anchor = W, activebackground = "orange")
# Host Name Button
self.host = BooleanVar()
host_name_button = Checkbutton(self, text="Host Name",variable=self.host, width=10)
host_name_button.grid(row = 1, column = 3, sticky = S)
host_name_button.config(anchor = W, activebackground = "yellow")
# Gateway Button
self.gateway = BooleanVar()
gateway_btn = Checkbutton(self, text="Gateway", variable=self.gateway, width=10)
gateway_btn.grid(row = 2, column = 3, sticky = N)
gateway_btn.config(anchor = W, activebackground = "green")
# Services Button
self.service = BooleanVar()
service_btn = Checkbutton(self, text="Services", variable = self.service, width=10)
service_btn.grid(row = 2, column = 3)
service_btn.config(anchor = W, activebackground = "blue")
# Starting IP label
ip_label = Label(self, text = "Starting IP: ")
ip_label.grid(row = 5, column = 0, pady = 1, padx = 3, sticky = W)
self.ip_from = Entry(self, width = 15)
self.ip_from.insert(0, start_ip)
self.ip_from.grid(row = 5 , column = 0, pady = 1, padx = 3, sticky = E)
# Ending IP label
ip_label_two = Label(self, text = "Ending IP: ")
ip_label_two.grid(row = 5, column = 1, pady = 1, padx = 5, sticky = W)
self.ip_to = Entry(self, width = 15)
self.ip_to.insert(0, end_ip)
self.ip_to.grid(row = 5 , column = 1, pady = 1, padx = 5, sticky = E)
# Starting Port Label
port_label = Label(self, text = "Starting Port: ")
port_label.grid(row = 5, column = 0, pady = 3, padx = 5, sticky = S+W)
self.port_from = Entry(self, width = 15)
self.port_from.insert(0, 0)
self.port_from.grid(row = 5 , column = 0, pady = 1, padx = 5, sticky = S+E)
# Ending Port Label
port_label_two = Label(self, text = "Ending Port: ")
port_label_two.grid(row = 5, column = 1, pady = 3, padx = 5, sticky = S+W)
self.port_to = Entry(self, width = 15)
self.port_to.insert(0, 1025)
self.port_to.grid(row = 5 , column = 1, pady = 1, padx = 5, sticky = S+E)
# Scan Me
self_scan_button = Button(self, text="Scan Me", command = lambda : self.onClick(1), width = 33)
self_scan_button.grid(row = 6, column = 1, sticky = N)
# Scan near me Button
scan_other_button = Button(self, text="Scan Near Me", width = 33, command = lambda : self.onClick(2))
scan_other_button.grid(row = 6, column = 0, pady=1, sticky = N)
# Clear button
clear_button = Button(self, text="Clear text", command = self.clear_text, width = 12)
clear_button.grid(row = 6, column = 3, pady=1, sticky = N)
#.........這裏部分代碼省略.........
示例2: MPExportApp
# 需要導入模塊: from ttk import Progressbar [as 別名]
# 或者: from ttk.Progressbar import config [as 別名]
class MPExportApp(object):
"""docstring for MPExportApp"""
def __init__(self, master):
super(MPExportApp, self).__init__()
self.master = master
self.export_type = StringVar()
master.columnconfigure(1, weight=1)
export_type_label = Label(master, text="Data Type: ")
export_type_label.grid(row=0, column=0, sticky=E)
radio_group_frame = Frame(master)
radio_group_frame.grid(row=0, column=1, sticky=W)
self.events_radio_button = Radiobutton(radio_group_frame, text='Events', value='events', variable=self.export_type,
command=self.radio_button_changed)
self.events_radio_button.select()
self.events_radio_button.grid(row=0, column=0)
self.people_radio_button = Radiobutton(radio_group_frame, text='People', value='people', variable=self.export_type,
command=self.radio_button_changed)
self.people_radio_button.grid(row=0, column=1)
api_key_label = Label(master, text="API Key: ")
api_key_label.grid(row=1, column=0, sticky=E)
self.api_key_entry = Entry(master)
self.api_key_entry.grid(row=1, column=1, columnspan=2, sticky=(E,W))
api_secret_label = Label(master, text="API Secret: ")
api_secret_label.grid(row=2, column=0, sticky=E)
self.api_secret_entry = Entry(master)
self.api_secret_entry.grid(row=2, column=1, columnspan=2, sticky=(E, W))
self.project_token_label = Label(master, text="Project Token: ", state=DISABLED)
self.project_token_label.grid(row=3, column=0, sticky=E)
self.project_token_entry = Entry(master, state=DISABLED)
self.project_token_entry.grid(row=3, column=1, columnspan=2, sticky=(E, W))
self.events_label = Label(master, text="Events: ")
self.events_label.grid(row=4, column=0, sticky=E)
self.events_entry = Entry(master)
self.events_entry.insert(0, 'Event A,Event B,Event C')
self.events_entry.bind('<FocusIn>', partial(self.clear_placeholder_text, self.events_entry))
self.events_entry.grid(row=4, column=1, columnspan=2, sticky=(E, W))
where_label = Label(master, text="Where: ")
where_label.grid(row=5, column=0, sticky=E)
self.where_entry = Entry(master)
self.where_entry.grid(row=5, column=1, columnspan=2, sticky=(E, W))
self.from_date_label = Label(master, text="From Date: ")
self.from_date_label.grid(row=6, column=0, sticky=E)
self.from_date_entry = Entry(master)
self.from_date_entry.insert(0, 'YYYY-MM-DD')
self.from_date_entry.bind('<FocusIn>', partial(self.clear_placeholder_text, self.from_date_entry))
self.from_date_entry.grid(row=6, column=1, columnspan=2, sticky=(E, W))
self.to_date_label = Label(master, text="To Date: ")
self.to_date_label.grid(row=7, column=0, sticky=E)
self.to_date_entry = Entry(master)
self.to_date_entry.insert(0, 'YYYY-MM-DD')
self.to_date_entry.bind('<FocusIn>', partial(self.clear_placeholder_text, self.to_date_entry))
self.to_date_entry.grid(row=7, column=1, columnspan=2, sticky=(E, W))
export_button = Button(master, text="EXPORT", fg="green", command=self.export)
export_button.grid(row=8, column=1, sticky=(E, W))
self.delete_button = Button(master, text="DELETE", fg='red', state=DISABLED,
command=lambda: threading.Thread(target=self.delete_people).start())
self.delete_button.grid(row=9, column=1, sticky=(E, W))
self.progress_bar = Progressbar(master)
self.progress_bar_value = IntVar()
self.progress_bar.config(mode='determinate', orient='horizontal', variable=self.progress_bar_value)
self.progress_bar.grid(row=10, column=0, columnspan=3, sticky=(E, W))
def clear_placeholder_text(self, entry, event):
entry_text = entry.get()
if entry_text == 'Event A,Event B,Event C' or entry_text == 'YYYY-MM-DD':
entry.delete(0, END)
def make_events_string(self, events):
events = events.replace(', ', ',')
events = events.split(',')
events_string = '['
for x in range(0, len(events)):
events_string += '"' + events[x] + '"'
if x != len(events)-1:
events_string += ','
else:
events_string += ']'
#.........這裏部分代碼省略.........
示例3: TkApplicationWindow
# 需要導入模塊: from ttk import Progressbar [as 別名]
# 或者: from ttk.Progressbar import config [as 別名]
class TkApplicationWindow(AbstractApplicationWindow):
def __init__(self, app):
self.root = Tk()
self.root.title("Llia")
self.root.config(background=factory.bg())
super(TkApplicationWindow, self).__init__(app, self.root)
self.root.withdraw()
if app.config()["enable-splash"]:
splash = TkSplashWindow(self.root, app)
self.root.deiconify()
self.root.protocol("WM_DELETE_WINDOW", self.exit_app)
self.llia_graph = None
self._main = layout.BorderFrame(self.root)
self._main.config(background=factory.bg())
self._main.pack(anchor="nw", expand=True, fill=BOTH)
self._progressbar = None
self._init_status_panel()
self._init_menu()
self._init_center_frame(self._main.center)
self.root.minsize(width=665, height=375)
self.group_windows = []
self.add_synth_group()
self._scene_filename = ""
def _init_status_panel(self):
south = self._main.south
south.configure(padx=4, pady=4)
self._lab_status = factory.label(south, "", modal=False)
b_panic = factory.panic_button(south)
b_down = factory.button(south, "-")
b_up = factory.button(south, "+")
b_panic.grid(row=0, column=0)
self._progressbar = Progressbar(south,mode="indeterminate")
self._progressbar.grid(row=0,column=PROGRESSBAR_COLUMN, sticky='w', padx=8)
self._lab_status.grid(row=0,column=4, sticky='w')
south.config(background=factory.bg())
b_down.configure(command=lambda: self.root.lower())
b_up.configure(command=lambda: self.root.lift())
self.update_progressbar(100, 0)
def _tab_change_callback(self, event):
self.llia_graph.sync()
def _init_center_frame(self, master):
nb = ttk.Notebook(master)
nb.pack(expand=True, fill="both")
frame_synths = layout.FlowGrid(nb, 6)
frame_efx = layout.FlowGrid(nb, 6)
frame_controllers = layout.FlowGrid(nb, 6)
self.llia_graph = LliaGraph(nb, self.app)
nb.add(frame_synths, text = "Synths")
nb.add(frame_efx, text = "Effects")
nb.add(frame_controllers, text = "Controllers")
nb.add(self.llia_graph, text="Graph")
nb.bind("<Button-1>", self._tab_change_callback)
def display_info_callback(event):
sp = event.widget.synth_spec
msg = "%s: %s" % (sp["format"],sp["description"])
self.status(msg)
def clear_info_callback(*_):
self.status("")
for st in con.SYNTH_TYPES:
sp = specs[st]
ttp = "Add %s Synthesizer (%s)" % (st, sp["description"])
b = factory.logo_button(frame_synths, st, ttip=ttp)
b.synth_spec = sp
b.bind("<Button-1>", self._show_add_synth_dialog)
b.bind("<Enter>", display_info_callback)
b.bind("<Leave>", clear_info_callback)
frame_synths.add(b)
for st in con.EFFECT_TYPES:
sp = specs[st]
ttp = "Add %s Effect (%s)" % (st, sp["description"])
b = factory.logo_button(frame_efx, st, ttip=ttp)
b.synth_spec = sp
b.bind("<Button-1>", self._show_add_efx_dialog)
b.bind("<Enter>", display_info_callback)
b.bind("<Leave>", clear_info_callback)
frame_efx.add(b)
for st in con.CONTROLLER_SYNTH_TYPES:
sp = specs[st]
ttp = "Add %s Effect (%s)" % (st, sp["description"])
b = factory.logo_button(frame_controllers, st, ttip=ttp)
b.synth_spec = sp
b.bind("<Button-1>", self._show_add_controller_dialog)
b.bind("<Enter>", display_info_callback)
b.bind("<Leave>", clear_info_callback)
frame_controllers.add(b)
@staticmethod
def menu(master):
m = Menu(master, tearoff=0)
m.config(background=factory.bg(), foreground=factory.fg())
return m
def _init_menu(self):
#.........這裏部分代碼省略.........
示例4: FindServer
# 需要導入模塊: from ttk import Progressbar [as 別名]
# 或者: from ttk.Progressbar import config [as 別名]
class FindServer(Frame):
def __init__(self, parent, controller):
Frame.__init__(self, parent)
self.selected = "";
self.controller = controller
label = Label(self, text="Select server", font=TITLE_FONT, justify=CENTER, anchor=CENTER)
label.pack(side="top", fill="x", pady=10)
self.button1 = Button(self, text="Next",state="disabled", command=self.callback_choose)
button2 = Button(self, text="Refresh", command=self.callback_refresh)
button3 = Button(self, text="Back", command=self.callback_start)
scrollbar = Scrollbar(self)
self.mylist = Listbox(self, width=100, yscrollcommand = scrollbar.set )
self.mylist.bind("<Double-Button-1>", self.twoClick)
self.button1.pack()
button2.pack()
button3.pack()
# create list with a scroolbar
scrollbar.pack( side = "right", fill="y" )
self.mylist.pack( side = "top", fill = "x", ipadx=20, ipady=20, padx=20, pady=20 )
scrollbar.config( command = self.mylist.yview )
# create a progress bar
label2 = Label(self, text="Refresh progress bar", justify='center', anchor='center')
label2.pack(side="top", fill="x")
self.bar_lenght = 200
self.pb = Progressbar(self, length=self.bar_lenght, mode='determinate')
self.pb.pack(side="top", anchor='center', ipadx=20, ipady=20, padx=10, pady=10)
self.pb.config(value=0)
# to select he server user must double-click on it
def twoClick(self, event):
widget = event.widget
selection=widget.curselection()
value = widget.get(selection[0])
self.selected = value
self.button1.config(state="normal")
# save the selected server in a global variable
SELECTED_SERV = SERVER_LIST[selection[0]]
set_globvar(SELECTED_SERV)
# listen for broadcasts from port 8192
def listen_broadcasts(self, port, timeout):
# Set the progress bar to 0
self.pb.config(value=0)
step_size = ((self.bar_lenght/(MAX_NR_OF_SERVERS+1))/2)
list_of_servers = []
# Initialize the listener
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.bind(('', port))
s.settimeout(LISTENING_TIMEOUT)
# Listen for a number of times to get multiple servers
for _ in range(MAX_NR_OF_SERVERS + 1):
# Update the progress bar
self.pb.step(step_size)
self.pb.update_idletasks()
try:
message, address = s.recvfrom(8192)
m_split = message.split(';')
if m_split[0] == '\HELLO':
server_id = (m_split[1], address)
# Check if the server has not yet broadcasted itself.
if server_id not in list_of_servers:
list_of_servers.append(server_id)
except:
pass
# Close the socket
s.close()
if not list_of_servers:
# If no server found, pop a warning message.
tkMessageBox.showwarning("Find Servers", "No servers found. Refresh or create a new game.")
# Set the progress bar back to 0
self.pb.config(value=0)
# Return the whole list of available servers
return list_of_servers
# service the refresh button
def callback_refresh(self):
global SERVER_LIST
self.mylist.delete(0,END)
SERVER_LIST = self.listen_broadcasts(BROADCASTING_PORT, LISTENING_TIMEOUT)
for server_el in SERVER_LIST:
self.mylist.insert(END,(" "+str(server_el[0])+" IP: "+str(server_el[1])+" Time: "+str(time.asctime())))
def callback_choose(self):
self.mylist.delete(0,END)
self.button1.config(state="disabled")
self.controller.show_frame("ChooseType")
def callback_start(self):
self.mylist.delete(0,END)
self.button1.config(state="disabled")
self.controller.show_frame("StartPage")
示例5: LowerScrollingFrame
# 需要導入模塊: from ttk import Progressbar [as 別名]
# 或者: from ttk.Progressbar import config [as 別名]
class LowerScrollingFrame(ScrollableFrame):
#self.mangaFrame ==> the MangaFrame that we get our image and updates from
def __init__(self,parent,*args,**kwargs):
self.parent=parent
ScrollableFrame.__init__(self,self.parent,*args,**kwargs)
self.disableDynamicRows() #really annoying to have it on
self.__body()
self.mangaFrame=None
self.imageNotFound=self.image=ImageTk.PhotoImage(Image.open("Image-not-found.gif"))
self.image=self.imageNotFound
self.redraw()
def __body(self):
self.BUTTONS={}
self.BUTTONS["Update"]=Button(self,text="Update",command=self.updateManga)
self.BUTTONS["CheckForUpdates"]=Button(self,text="Check Updates",command=self.updateManga_check)
self.BUTTONS["Delete"]=Button(self,text="Delete",command=self.deleteManga)
self.BUTTONS["Update"].grid(row=0,column=0,sticky=N+S+E+W)
self.BUTTONS["CheckForUpdates"].grid(row=1,column=0,sticky='nsew')
self.BUTTONS["Delete"].grid(row=2,column=0,sticky=N+S+E+W)
self.LABELS={}
self.LABELS["Status"]=Label(self,text="Status:\nUnknown")
self.LABELS["ChapterCount"]=Label(self,text="Chapters:\nUnknown")
self.LABELS["Updates"]=Label(self,text="Updates:\nUnknown")
self.LABELS["Summary"]=LabelResizing(self,text="Summary:\n")
self.LABELS["Picture"]=Label(self,image=None)
self.LABELS["UpdatingStatus"]=Label(self,text="")
self.LABELS["Status"].grid(row=0,column=1)
self.LABELS["ChapterCount"].grid(row=1,column=1)
self.LABELS["Updates"].grid(row=2,column=1)
self.LABELS["Summary"].grid(row=3,column=0,sticky='nwe')
self.LABELS["Picture"].grid(row=0,column=2,rowspan=5)
self.LABELS["UpdatingStatus"].grid(row=5,column=0,columnspan=3)
self.PROGRESSBAR=Progressbar(self)
self.PROGRESSBAR.grid(row=6,column=0,columnspan=3,sticky=E+W)
self.bindChidrenScrolling()
self.grid_columnconfigure(0,weight=1)
self.grid_columnconfigure(1,weight=2)
def setManga(self,MangaFrame):
#this should be a manga frame
self.mangaFrame=MangaFrame
self.image=self.mangaFrame.getImage()
self.redraw()
def redraw(self,*args):
try:
if self.mangaFrame.inProgress==False:self.BUTTONS["Update"].config(text="Update")
else:self.BUTTONS["Update"].config(text="Cancel")
self.LABELS["ChapterCount"].config(text="{} Chapters".format(self.mangaFrame.numberOfChapters()))
self.LABELS["Updates"].config(text="{} Updates".format(self.mangaFrame.numberOfUpdates()))
self.progressSet(self.mangaFrame.getProgress())
self.LABELS["UpdatingStatus"].config(text=self.mangaFrame.getStatus())
self.LABELS["Summary"].config(text="Summary: "+self.mangaFrame.getSummary())
except Exception as e:
print e
self.LABELS["Status"].config(text="Status:\nUnknown")
self.LABELS["ChapterCount"].config(text="Chapters:\nUnknown")
self.LABELS["Updates"].config(text="Updates:\nUnknown")
self.progressReset()
self.LABELS["UpdatingStatus"].config(text="")
self.LABELS["Summary"].config(text="Summary:\nUnknown")
self.LABELS["Picture"].config(image=self.image)
def progressSet(self,value):
self.PROGRESSBAR.config(value=value)
def progressStep(self,value):
self.PROGRESSBAR.step(value)
def progressReset(self):
self.PROGRESSBAR.config(value=0)
def updateManga(self):
if not self.mangaFrame.inProgress:self.mangaFrame.updateManga(self)
else: self.mangaFrame.cancelUpdate()
self.redraw()
def updateManga_check(self):
self.mangaFrame.updateManga_check() #look to see if there are any updates
self.redraw() #change the number we have for the number of updates
def deleteManga(self):
rmtree("files/"+self.mangaFrame.getName())
self.parent.populateLibrary()
self.mangaFrame=None
self.image=self.imageNotFound
self.redraw()
示例6: __init__
# 需要導入模塊: from ttk import Progressbar [as 別名]
# 或者: from ttk.Progressbar import config [as 別名]
class YoutubeScript:
def __init__(self):
self.totDownloadSize = 0
self.completedSize = 0
self.saveData = {
"url": "",
"title": "",
"selected": [],
"completed": [],
"savetype": ""
}
def initUi(self):
self.ipGui = Tk()
self.ipGui.wm_title("YtD by T90")
self.ipGui.wm_minsize(700, 150)
self.titleFrame = Frame(self.ipGui, height=100, width=500, relief=RAISED, bg="#555")
self.titleFrame.pack(fill=BOTH)
titleLabel = Label(self.titleFrame, text="Youtube Downloader Script", bg="#555", fg="#fff", font=("Arial", 16))
subTitleLabel = Label(self.titleFrame, text="By T90", bg="#555", fg="#ddd")
titleLabel.pack(fill=X, side=TOP, pady=3)
subTitleLabel.pack(fill=X, side=BOTTOM)
self.ipFrame = Frame(self.ipGui, height=200, width=500, relief=RAISED, bg="#bbb")
self.ipFrame.pack(fill=BOTH, padx=3, pady=3)
self.urlBox = Entry(self.ipFrame, relief=RAISED, fg="#777")
self.urlBox.focus()
self.urlBtn = Button(self.ipFrame, text="Download", height=2, bg="#777", fg="#eee", command=self.startDownload)
self.urlBox.pack(fill=BOTH, padx=20, pady=10)
self.urlBtn.pack(fill=BOTH, padx=50, pady=10)
# self.urlBox.insert(0, "https://www.youtube.com/playlist?list=PLYvPGplh5--N1zwtg_5-z3kVW9U92FUc2")
self.selectVidsFrame = Frame(self.ipGui, bg="#bbb")
selectLabel = Label(self.selectVidsFrame, text="Select videos to be downloaded and click on Start.", bg="#bbb")
self.vidsListBox = Listbox(self.selectVidsFrame, bg="#bbb", relief=RAISED, selectmode=EXTENDED,
selectbackground="#888", selectforeground="#fff", borderwidth=1,
highlightthickness=0, activestyle="none")
self.selectVidsBtn = Button(self.selectVidsFrame, text="Start", height=2, bg="#777", fg="#eee",
command=self.selectVids)
selectLabel.pack(fill=X, padx=3, pady=3)
self.vidsListBox.pack(fill=X, padx=10, pady=10)
self.selectVidsBtn.pack(fill=X, padx=50, pady=10)
self.progFrame = Frame(self.ipGui, height=200, width=500, relief=SUNKEN, bg="#bbb")
self.titleInProgFrame = Frame(self.progFrame, bg="#bbb")
self.status1InProgFrame = Frame(self.progFrame, bg="#bbb")
self.status2InProgFrame = Frame(self.progFrame, bg="#bbb")
self.progInProgFrame = Frame(self.progFrame, bg="#bbb")
self.vidTitleLabel = Label(self.titleInProgFrame, text="Fetching videos, please wait...", bg="#bbb", fg="#333")
self.thisVidCompletedTitle = Label(self.status1InProgFrame, text="Completed:", bg="#bbb", fg="#333",
justify="right")
self.thisVidCompletedText = Label(self.status1InProgFrame, text="0 MB", bg="#bbb", fg="#333", justify="left")
self.thisVidSizeTitle = Label(self.status1InProgFrame, text="Size:", bg="#bbb", fg="#333", justify="right")
self.thisVidSizeText = Label(self.status1InProgFrame, text="calculating", bg="#bbb", fg="#333", justify="left")
self.totVidCompletedTitle = Label(self.status1InProgFrame, text="Total downloaded:", bg="#bbb", fg="#333",
justify="right")
self.totVidCompletedText = Label(self.status1InProgFrame, text="0 MB", bg="#bbb", fg="#333", justify="left")
self.totVidSizeTitle = Label(self.status1InProgFrame, text="Total Size:", bg="#bbb", fg="#333", justify="right")
self.totVidSizeText = Label(self.status1InProgFrame, text="calculating", bg="#bbb", fg="#333", justify="left")
self.curSpeedTitle = Label(self.status2InProgFrame, text="Speed:", bg="#bbb", fg="#333", justify="right")
self.curSpeedText = Label(self.status2InProgFrame, text="0 mbps", bg="#bbb", fg="#333", justify="left")
self.vidLengthTitle = Label(self.status2InProgFrame, text="Video duration:", bg="#bbb", fg="#333",
justify="right")
self.vidLengthText = Label(self.status2InProgFrame, text="calculating", bg="#bbb", fg="#333", justify="left")
self.etaTitle = Label(self.status2InProgFrame, text="ETA:", bg="#bbb", fg="#333", justify="right")
self.etaText = Label(self.status2InProgFrame, text="calculating", bg="#bbb", fg="#333", justify="left")
self.timeTakenTitle = Label(self.status2InProgFrame, text="Time Taken:", bg="#bbb", fg="#333", justify="right")
self.timeTakenText = Label(self.status2InProgFrame, text="calculating", bg="#bbb", fg="#333", justify="left")
self.totProgLabel = Label(self.progInProgFrame, text="Total Progress", bg="#bbb", fg="#333")
s = Style()
s.theme_use('alt')
s.configure("grey.Horizontal.TProgressbar", foreground='#eee', background='#888')
self.indiProg = Progressbar(self.progInProgFrame, style="grey.Horizontal.TProgressbar", orient='horizontal',
mode='determinate', maximum=100)
self.totProg = Progressbar(self.progInProgFrame, style="grey.Horizontal.TProgressbar", orient='horizontal',
mode='determinate', maximum=100)
self.openDownloadFolderBtn = Button(self.progInProgFrame, text="Open Download Location", height=2, bg="#777",
fg="#eee", command=self.openDownloadFolder)
self.titleInProgFrame.pack(fill=BOTH, expand=1)
self.status1InProgFrame.pack(fill=BOTH, expand=1)
self.status2InProgFrame.pack(fill=BOTH, expand=1)
self.progInProgFrame.pack(fill=BOTH, expand=1)
self.vidTitleLabel.pack(fill=BOTH, expand=1, padx=50, pady=10, side=TOP)
self.thisVidCompletedTitle.pack(fill=BOTH, expand=1, side=LEFT)
self.thisVidCompletedText.pack(fill=BOTH, expand=1, side=LEFT)
self.thisVidSizeTitle.pack(fill=BOTH, expand=1, side=LEFT)
self.thisVidSizeText.pack(fill=BOTH, expand=1, side=LEFT)
self.totVidCompletedTitle.pack(fill=BOTH, expand=1, side=LEFT)
self.totVidCompletedText.pack(fill=BOTH, expand=1, side=LEFT)
#.........這裏部分代碼省略.........
示例7: TkSynthWindow
# 需要導入模塊: from ttk import Progressbar [as 別名]
# 或者: from ttk.Progressbar import config [as 別名]
class TkSynthWindow(Frame):
"""
Provides common synth editor elements:
bank editor
MIDI tab
Mapping tabs
TkSynthWindow is customized by adding one or more TkSubEditor.
"""
def __init__(self, master, sproxy):
"""
Construct new TkSynthWindow
master - The Tk container for self. In practice this is an
instance of llia.gui.tk.GroupWindow
sproxy - An instance of llia.Proxy.
"""
Frame.__init__(self, master)
self.config(background=factory.bg())
self.synth = sproxy
self.synth.synth_editor = self
self.app = sproxy.app
self.sid = sproxy.sid
self.group_index = -1
factory.set_pallet(sproxy.specs["pallet"])
main = factory.paned_window(self)
main.pack(expand=True, fill="both")
self.bank_editor = TkBankEditor(main, self, sproxy)
self.bus_and_buffer_editor = None
east = factory.frame(main)
self.notebook = factory.notebook(east)
self.notebook.pack(anchor="nw", expand=True, fill="both")
south = factory.frame(east)
south.pack(after=self.notebook, anchor="w", expand=True, fill="x")
self._lab_status = factory.label(south, "<status>")
self._lab_extended = factory.label(south, "")
b_panic = factory.panic_button(south, command=self.panic)
b_lower = factory.button(south, "-", command=self.lower_window)
b_lift = factory.button(south, "+", command=self.lift_window)
b_panic.grid(row=0, column=0)
self._lab_status.grid(row=0, column=4, sticky='ew')
self._lab_extended.grid(row=0,column=5,sticky='e',padx=16)
self._lab_extended.config(fg="#f1f1cd")
self._progressbar = Progressbar(south,mode="indeterminate")
self._progressbar.grid(row=0,column=PROGRESSBAR_COLUMN, sticky='w', padx=8)
south.config(background=factory.bg())
main.add(self.bank_editor)
main.add(east)
self.list_channel = None
self.list_keytab = None
self.var_transpose = StringVar()
self.var_keyrange_low = StringVar()
self.var_keyrange_high = StringVar()
self.var_bendrange = StringVar()
self._init_midi_tab(self.notebook)
self._init_map1_tab(self.notebook) # MIDI controllers and pitchwheel
self._init_map2_tab(self.notebook) # velocity, aftertouch, keynumber
self._init_info_tab(self.notebook)
self._child_editors = {}
self.update_progressbar(100, 0)
def enable(self, flag):
for ed in self._child_editors.values():
ed.enable(flag)
if flag:
msg = ""
else:
msg = "Editor locked while in extended mode"
self._lab_extended.config(text=msg)
def panic(self):
self.synth.osc_transmitter.x_all_notes_off()
self.status("All notes off")
def clear_status(self):
self._lab_status.config(text="")
def add_child_editor(self, child_name, child):
# Adds child editor to list of editors without adding a notebook tab.
self._child_editors[child_name] = child
def _create_basic_tab(self,text):
f = factory.frame(self.notebook)
self.notebook.add(f, text=text)
return f
# icon_filename = "resources/%s/logo_32.png" % sy.specs["format"]
# icon = factory.image(icon_filename)
# group.notebook.add(swin, text=sy.sid, image=icon, compound="top")
def _create_compund_tab(self,text,image_filename):
try:
icon = factory.image(image_filename)
f = factory.frame(self.notebook)
self.notebook.add(f,text=text,image=icon,compound="top")
return f
except IOError:
#.........這裏部分代碼省略.........