本文整理汇总了Python中ttk.Progressbar类的典型用法代码示例。如果您正苦于以下问题:Python Progressbar类的具体用法?Python Progressbar怎么用?Python Progressbar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Progressbar类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent, **kwargs):
"""!
A constructor for the class
@param self The pointer for the object
@param parent The parent object for the frame
@param **kwargs Other arguments as accepted by ttk.Scrollbar
"""
#Initialise the inherited class
Progressbar.__init__(self, parent, **kwargs)
开发者ID:benjohnston24,项目名称:stdtoolbox,代码行数:9,代码来源:stdGUI.py
示例2: splashscreen
def splashscreen():
root = Tk()
root.geometry("+200+200")
root.overrideredirect(True)
root.configure(bg = "white")
back = PhotoImage(file = "splashscreen.gif")
l1 = Label(root, image = back, bg = "white")
scritta = Progressbar(root, orient = "horizontal", mode = "determinate", length = 240)
scritta.start(30)
copyright = Label(root, text = "Copyright by lokk3d", bg = "white")
root.after(3000, root.destroy)
l1.pack()
scritta.pack(side = "left")
copyright.pack( side = "right")
root.mainloop()
开发者ID:Tecnowiki,项目名称:python-gui-tutorial-by-Tecnowiki,代码行数:15,代码来源:splashscreen-eSpeakTk.py
示例3: __init__
def __init__(self, master):
self.root = master
self.searching = False
self.can_download = True
audiojack.set_useragent('AudioJack', '1.0')
self.frame = ScrollableFrame(self.root)
self.frame.setconfig(bg='#0D47A1', width=1280, height=720)
self.frame.pack(side=TOP, fill=BOTH, expand=1)
self.label = Label(self.frame.mainframe, text='AudioJack', fg='#ffffff', bg=self.frame.mainframe['background'], font=('Segoe UI', 48))
self.label.pack()
self.url_entry = Entry(self.frame.mainframe, width=48, font=('Segoe UI', 20), bg='#1565C0', bd=2, highlightthickness=1, highlightcolor='#1565C0', highlightbackground='#0D47A1', fg='#ffffff', insertbackground='#ffffff', relief=FLAT, insertwidth=1)
self.url_entry.pack()
self.submit_button = Button(self.frame.mainframe, width=60, font=('Segoe UI', 16), text='Go!', bd=0, bg='#1E88E5', fg='#ffffff', activebackground='#2196F3', activeforeground='#ffffff', relief=SUNKEN, cursor='hand2', command=self.submit)
self.submit_button.pack()
self.search_progress = Progressbar(self.frame.mainframe, orient='horizontal', length=720, maximum=100 ,mode='indeterminate')
self.error_info = Label(self.frame.mainframe, fg='#ff0000', bg=self.frame.mainframe['background'])
# Use pack_forget on this to reset the view
self.contents = Frame(self.frame.mainframe, bg=self.frame.mainframe['background'])
# Contains results and custom tag options
self.select_frame = Frame(self.contents, bg=self.frame.mainframe['background'])
self.select_frame.pack()
#Search results
self.results_label = Label(self.select_frame, text='Results:', fg='#ffffff', bg=self.frame.mainframe['background'])
self.results_frame = Frame(self.select_frame, bg=self.frame.mainframe['background'])
self.results_label.pack()
self.results_frame.pack()
# Downloads
self.file_label = Label(self.contents, fg='#ffffff', bg=self.frame.mainframe['background'])
开发者ID:Blue9,项目名称:AudioJack-GUI,代码行数:34,代码来源:audiojack_gui_beta.py
示例4: __init__
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)
开发者ID:kristapsdreija,项目名称:Frogs-vs-Flies,代码行数:30,代码来源:tkinter_main.py
示例5: __body
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)
开发者ID:glop102,项目名称:mangaDownloaderKindle,代码行数:31,代码来源:LowerScrollingFrame.py
示例6: __init__
def __init__(self, parent, *args, **kwargs):
self.pssm = Pssm(path_to_lookup=AssetWrapper('micall/g2p/g2p_fpr.txt').path,
path_to_matrix=AssetWrapper('micall/g2p/g2p.matrix').path)
tk.Frame.__init__(self, parent, *args, **kwargs)
self.parent = parent
parent.report_callback_exception = self.report_callback_exception
self.rundir = None # path to MiSeq run folder containing data
self.workdir = gettempdir() # default to temp directory
os.chdir(self.workdir)
self.line_counter = LineCounter()
self.run_info = None
self.target_files = []
self.button_frame = tk.Frame(self)
self.button_frame.pack(side='top')
self.console_frame = tk.Frame(self)
self.console_frame.pack(side='top', fill='both', expand=True)
try:
with open(MiCall.CONFIG_FILE, 'rU') as f:
self.config = json.load(f)
except:
self.config = {}
self.nthreads = self.config.get('threads', None)
if not self.nthreads:
self.nthreads = int(round(cpu_count() * 0.5))
self.config['threads'] = self.nthreads
self.write_config()
self.button_run = tk.Button(
self.button_frame, text="Run", command=self.process_files
)
self.button_run.grid(row=0, column=1, sticky='W')
self.progress_bar = Progressbar(self.button_frame, orient='horizontal', length=500, mode='determinate')
self.progress_bar.grid(row=1, columnspan=5)
scrollbar = tk.Scrollbar(self.console_frame)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
self.console = tk.Text(self.console_frame,
bg='black',
fg='white',
yscrollcommand=scrollbar.set)
self.console.pack(side=tk.LEFT, fill=tk.BOTH)
self.console.tag_configure('ERROR', foreground="red")
scrollbar.config(command=self.console.yview)
# redirect stderr to Text widget
#sys.stderr = Redirector(self.console)
self.write('Welcome to MiCall v{}, running with {} threads.\n'.format(
pipeline_version,
self.nthreads))
开发者ID:tarah28,项目名称:MiCall,代码行数:58,代码来源:micall.py
示例7: __init__
def __init__(self, tk_frame, police, **kwargs):
LabelFrame.__init__(self, tk_frame, text="Tirage", font=police, **kwargs)
self.waiting_time = 10
self.message = Label(self, text="Appuyez sur le bouton pour lancer le tirage", font=police)
self.message.grid(column=0, row=0, columnspan=2)
self.bouton_quitter = Button(self, text="Quitter", command=self.quit, font=police)
self.bouton_quitter.grid(column=0, row=1, pady=10)
self.bouton_cliquer = Button(self, text="Lancer!", fg="red",
command=self.click, font=police)
self.bouton_cliquer.grid(column=1, row=1)
self.message_price = Label(self, text="Tirage pour:", font=police)
self.price = Label(self, text='', bg="white", width=40, height=1, font=police)
self.message_price.grid(column=0, row=3)
self.price.grid(column=1, row=3, columnspan=1, padx=10, pady=10)
self.message_name = Label(self, text="Le gagnant est:", font=police)
self.name = Label(self, text="", bg="white", width=40, height=1, font=police)
self.message_name.grid(column=0, row=4)
self.name.grid(column=1, row=4, columnspan=1, pady=10)
self.parent_name = self.winfo_parent()
self.parent = self._nametowidget(self.parent_name)
# Part waiting time
self.interval = Label(self, text="Intervalle entre tirages (s)", font=police)
self.interval.grid(column=0, row=6, columnspan=1, pady=10)
self.v = StringVar()
self.v.set(self.waiting_time)
self.interval_length = Entry(self, textvariable=self.v, width=5, justify=CENTER, font=police)
self.interval_length.grid(column=1, row=6, columnspan=1)
self.progress_bar = Progressbar(self, length=300)
self.progress_bar.grid(column=0, row=8, columnspan=2, pady=10)
self.nb_players_text = Label(self, text="Nombre de joueurs", font=police)
self.nb_players_text.grid(column=0, row=10, columnspan=1, pady=10)
self.nb_players = Label(self, text="0", font=police)
self.nb_players.grid(column=1, row=10, columnspan=1, pady=10)
self.nb_prices_text = Label(self, text="Nombre de prix restants", font=police)
self.nb_prices_text.grid(column=0, row=11, columnspan=1, pady=10)
self.nb_prices = Label(self, text="0", font=police)
self.nb_prices.grid(column=1, row=11, columnspan=1, pady=10)
# police=tkFont.Font(self, size=12)#, family='Courier')
# self.config(, font=police)
# for i in range(5):
# self.grid_rowconfigure(2, weight=1)
# self.grid_rowconfigure(5, weight=1)
# self.grid_rowconfigure(7, weight=1)
# self.grid_rowconfigure(9, weight=1)
for i in range(2):
self.grid_columnconfigure(i, weight=1)
开发者ID:werdeil,项目名称:tombola_python,代码行数:54,代码来源:gui.py
示例8: sonifyProcessPage
def sonifyProcessPage(self):
Label(self, text="Processing", justify=CENTER, font=root.fontH1).pack(pady=20)
self.processing = Label(self, text="", justify=CENTER)
self.processing.pack(pady=20)
self.pbar = Progressbar(self, orient='horizontal', mode='indeterminate')
self.pbar.start(10)
self.pbar.pack()
self.after(100, self.sonifyProcess)
开发者ID:MaroGM,项目名称:gendersonification,代码行数:12,代码来源:main.py
示例9: __init__
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)
开发者ID:plewto,项目名称:Llia,代码行数:52,代码来源:tk_synthwindow.py
示例10: init_ui
def init_ui(self):
MyFrame.init_ui(self)
self.columnconfigure(0, weight=2, minsize=150)
self.columnconfigure(1, weight=3, minsize=100)
self.file_name = TextEntry(self, 'Recorded file name')
self.record_time = TextEntry(self, 'Record time')
self.progress_bar = Progressbar(self, orient='horizontal', mode='determinate')
self.progress_bar.grid(columnspan=2, sticky='NESW')
Button(self, text='Record', command=self.threaded_record).grid(columnspan=2, sticky='NESW')
开发者ID:pasiasty,项目名称:voice_authentication_library,代码行数:13,代码来源:RecordFrame.py
示例11: __init__
def __init__(self, title, txt):
LabelFrame.__init__(self, text=title)
# Bar of global progress
Label(self, text = 'Global progress').grid(row=1, column = 0)
self.proglob = Progressbar(self,
orient = HORIZONTAL,
max = 50,
length = 200,
mode = 'determinate')
# Bar of attributes progress
Label(self, text = 'Attributes progress').grid(row=3, column = 0)
self.progatt = Progressbar(self,
orient = HORIZONTAL,
max = 50,
length = 200,
mode = 'determinate')
# Widgets placement
self.proglob.grid(row=2, column = 0, sticky = N+S+W+E,
padx = 2, pady = 2)
self.progatt.grid(row=4, column = 0, sticky = N+S+W+E,
padx = 2, pady = 2)
开发者ID:Guts,项目名称:Metadator,代码行数:22,代码来源:test_ClassGUI_MultiFrames.py
示例12: _init_status_panel
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)
开发者ID:plewto,项目名称:Llia,代码行数:15,代码来源:tk_appwindow.py
示例13: __init__
def __init__(self, master, _ndpi_file):
self.master = master
# For WBC-hunt
self.hunter = False
# Call the super constructor
Canvas.__init__(self, master)
#self.canvas = Canvas(self, master)
# Zoom or roi mode (defaults to roi)
self.mode = "roi"
# Setup the input file
self.ndpi_file = _ndpi_file
self.im = None # Actual PhotoImage object of the image
self.rgba_im = None # This is needed as a kept reference so that we can resize image on user action
self.current_level = None # Scale space level currently used for viewing (for handling zoom etc)
self.image_handle = None # Used to delete and recreate images
self.setup_image()
# Stuff for box selection
self.init_box_pos = None # In WINDOW coordinates
self.curr_box_bbox = None # Also in current WINDOW coordinates
self.last_selection_region = None # This is in level 0 coordinates
self.zoom_level = 0 # How many times have we zoomed?
self.zoom_region = [] # Stack of regions in level 0 coords that tells us where the zoom is, needed for transforming
# Since we want multiple ROIs, save them in this list
self.roi_list = [] # Contains Triple: (ROInumber, ROI_imagedata, (bbox, [sub_rois_list]))
self.roi_counter = 0
self.progress = Progressbar(self, orient="horizontal", length=100, mode="determinate", value=0)
# ProgressBar to show user what is going on. Only one active at a time
# Bind some event happenings to appropriate methods
self.bind('<Configure>', self.resize_image)
self.bind('<B1-Motion>', self.select_box)
self.bind('<Button-1>', self.set_init_box_pos)
self.bind('<ButtonRelease-1>', self.set_box)
self.bind('<Button-3>', self.zoom_out)
self.bind('<Left>', self.move_up)
# DEBUG
self.counter = 0
开发者ID:tsbb11stressedblood,项目名称:stressedblood,代码行数:48,代码来源:gui.py
示例14: __init__
def __init__(self, parent=None, **kwargs):
Frame.__init__(self, parent)
self.parent = parent
self.job_list_yscroll = Scrollbar(self, orient=Tkinter.VERTICAL)
self.job_list_xscroll = Scrollbar(self, orient=Tkinter.HORIZONTAL)
self.job_list = Listbox(self, xscrollcommand=self.job_list_xscroll, yscrollcommand=self.job_list_yscroll)
self.job_list_xscroll['command'] = self.job_list.xview
self.job_list_yscroll['command'] = self.job_list.yview
self.new_job_frame = Frame(self)
add_icon_filename = kwargs['add_icon_filename'] if 'add_icon_filename' in kwargs else None
if add_icon_filename == None:
self.add_job_button = Button(self.new_job_frame, text='Add Job', command=self.on_add)
else:
add_icon = PhotoImage(file=add_icon_filename)
self.add_job_button = Button(self.new_job_frame, text='Add Job', compound='bottom', image=add_icon, command=self.on_add)
self.remove_job_button = Button(self.new_job_frame, text='Remove Job', command=self.on_remove)
self.progress_frame = Frame(self)
self.progress_value = Tkinter.IntVar()
self.progress_bar = Progressbar(self.progress_frame, variable=self.progress_value)
self.button_frame = Frame(self)
self.process_button = ProcessButton(parent=self.button_frame, start_jobs=self.start_jobs)
self.quit_button = QuitButton(parent=self.button_frame, close_other_windows=self.close_top_level_windows)
self.run_job = kwargs['run_job'] if 'run_job' in kwargs else None
self.create_plots = kwargs['create_plots'] if 'create_plots' in kwargs else None
self.log_filename = kwargs['log_filename'] if 'log_filename' in kwargs else None
self.bind('<<AskToClearJobs>>', self.ask_to_clear_jobs)
self.bind('<<AskToPlotGraphs>>', self.ask_to_plot_graphs)
self.bind('<<CreatePlotGUI>>', self.create_plot_gui)
self.parent.bind('<ButtonPress>', self.on_press)
self.parent.bind('<Configure>', self.on_resize)
self.reinit_variables()
self.top_level_windows = list()
# NOTE: Because there seems to be an issue resizing child widgets when the top level (Tk) widget is being resized,
# the resize option will be disabled for this window
self.parent.resizable(width=False, height=False)
self.lift()
开发者ID:jhavstad,项目名称:model_runner,代码行数:44,代码来源:ModelRunnerGUI.py
示例15: __init__
def __init__(self):
root.title("MuBlas")
self.lab1 = Label(root, text="Music directory")
self.lab1.grid(row = 0, column = 0)
self.music_entry = Entry(root,width=50,bd=1)
self.music_entry.grid(row = 1, column = 0)
self.m_dir_but = Button(root)
self.m_dir_but["text"] = "Choose directory"
self.m_dir_but.grid(row = 1, column = 1)
self.m_dir_but.bind("<Button-1>", self.ask_mus_dir)
self.lab3 = Label(root, text="Size in MBytes")
self.lab3.grid(row = 2, column = 0)
self.size_entry = Entry(root,width=5,bd=1)
self.size_entry.grid(row = 2, column = 1)
self.lab2 = Label(root, text="Destination directory")
self.lab2.grid(row = 3, column = 0)
self.destination_entry = Entry(root,width=50,bd=1)
self.destination_entry.grid(row = 4, column = 0)
self.dest_dir_but = Button(root)
self.dest_dir_but["text"] = "Choose directory"
self.dest_dir_but.grid(row = 4, column = 1)
self.dest_dir_but.bind("<Button-1>", self.ask_out_dir)
self.process_but = Button(root)
self.process_but["text"] = "Run"
self.process_but.grid(row = 6, column = 0)
self.process_but.bind("<Button-1>", self.start)
self.exit_but = Button(root)
self.exit_but["text"] = "Exit"
self.exit_but.grid(row = 6, column = 1)
self.exit_but.bind("<Button-1>", self.exit_app)
self.pr_bar = Progressbar(root, mode='indeterminate')
self.pr_bar.grid(row = 5, column = 0, sticky = "we", columnspan = 2)
开发者ID:offtirael,项目名称:MuBlas,代码行数:44,代码来源:main.py
示例16: __init__
def __init__(self, master, **options):
Progressbar.__init__(self, master, **options)
self.queue = Queue.Queue()
self.check_queue()
开发者ID:soycamo,项目名称:CoilSnake,代码行数:4,代码来源:widgets.py
示例17: InterfaceGauche
class InterfaceGauche(LabelFrame):
"""Left frame of the GUI, giving the buttons and the current price and winner"""
def __init__(self, tk_frame, police, **kwargs):
LabelFrame.__init__(self, tk_frame, text="Tirage", font=police, **kwargs)
self.waiting_time = 10
self.message = Label(self, text="Appuyez sur le bouton pour lancer le tirage", font=police)
self.message.grid(column=0, row=0, columnspan=2)
self.bouton_quitter = Button(self, text="Quitter", command=self.quit, font=police)
self.bouton_quitter.grid(column=0, row=1, pady=10)
self.bouton_cliquer = Button(self, text="Lancer!", fg="red",
command=self.click, font=police)
self.bouton_cliquer.grid(column=1, row=1)
self.message_price = Label(self, text="Tirage pour:", font=police)
self.price = Label(self, text='', bg="white", width=40, height=1, font=police)
self.message_price.grid(column=0, row=3)
self.price.grid(column=1, row=3, columnspan=1, padx=10, pady=10)
self.message_name = Label(self, text="Le gagnant est:", font=police)
self.name = Label(self, text="", bg="white", width=40, height=1, font=police)
self.message_name.grid(column=0, row=4)
self.name.grid(column=1, row=4, columnspan=1, pady=10)
self.parent_name = self.winfo_parent()
self.parent = self._nametowidget(self.parent_name)
# Part waiting time
self.interval = Label(self, text="Intervalle entre tirages (s)", font=police)
self.interval.grid(column=0, row=6, columnspan=1, pady=10)
self.v = StringVar()
self.v.set(self.waiting_time)
self.interval_length = Entry(self, textvariable=self.v, width=5, justify=CENTER, font=police)
self.interval_length.grid(column=1, row=6, columnspan=1)
self.progress_bar = Progressbar(self, length=300)
self.progress_bar.grid(column=0, row=8, columnspan=2, pady=10)
self.nb_players_text = Label(self, text="Nombre de joueurs", font=police)
self.nb_players_text.grid(column=0, row=10, columnspan=1, pady=10)
self.nb_players = Label(self, text="0", font=police)
self.nb_players.grid(column=1, row=10, columnspan=1, pady=10)
self.nb_prices_text = Label(self, text="Nombre de prix restants", font=police)
self.nb_prices_text.grid(column=0, row=11, columnspan=1, pady=10)
self.nb_prices = Label(self, text="0", font=police)
self.nb_prices.grid(column=1, row=11, columnspan=1, pady=10)
# police=tkFont.Font(self, size=12)#, family='Courier')
# self.config(, font=police)
# for i in range(5):
# self.grid_rowconfigure(2, weight=1)
# self.grid_rowconfigure(5, weight=1)
# self.grid_rowconfigure(7, weight=1)
# self.grid_rowconfigure(9, weight=1)
for i in range(2):
self.grid_columnconfigure(i, weight=1)
def click(self):
"""When click is selected, the tombola starts"""
try:
self.waiting_time = int(self.v.get())
except ValueError:
showerror("Error", "L'intervalle doit être un nombre")
return
self.progress_bar['maximum'] = self.waiting_time+0.01
self.interval_length.config(state=DISABLED)
self.parent.draw_tombola(self.waiting_time)
if not self.parent.list_prices:
self.bouton_cliquer.config(state=DISABLED)
self.price["text"] = "Tous les lots ont été tirés"
self.name["text"] = ""
self.update()
def update_nb_players(self):
self.nb_players["text"] = len(self.parent.list_names)
self.nb_players.update()
def update_nb_prices(self):
self.nb_prices["text"] = len(self.parent.list_prices)
self.nb_prices.update()
开发者ID:werdeil,项目名称:tombola_python,代码行数:81,代码来源:gui.py
示例18: FindServer
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")
开发者ID:kristapsdreija,项目名称:Frogs-vs-Flies,代码行数:98,代码来源:tkinter_main.py
示例19: JobList
class JobList(Frame):
# NOTE: job_params contains information about a Job in the Joblist
# NOTE: plot_args contains information about plotting information, which occurs after the jobs have been and the data files have been created
def __init__(self, parent=None, **kwargs):
Frame.__init__(self, parent)
self.parent = parent
self.job_list_yscroll = Scrollbar(self, orient=Tkinter.VERTICAL)
self.job_list_xscroll = Scrollbar(self, orient=Tkinter.HORIZONTAL)
self.job_list = Listbox(self, xscrollcommand=self.job_list_xscroll, yscrollcommand=self.job_list_yscroll)
self.job_list_xscroll['command'] = self.job_list.xview
self.job_list_yscroll['command'] = self.job_list.yview
self.new_job_frame = Frame(self)
add_icon_filename = kwargs['add_icon_filename'] if 'add_icon_filename' in kwargs else None
if add_icon_filename == None:
self.add_job_button = Button(self.new_job_frame, text='Add Job', command=self.on_add)
else:
add_icon = PhotoImage(file=add_icon_filename)
self.add_job_button = Button(self.new_job_frame, text='Add Job', compound='bottom', image=add_icon, command=self.on_add)
self.remove_job_button = Button(self.new_job_frame, text='Remove Job', command=self.on_remove)
self.progress_frame = Frame(self)
self.progress_value = Tkinter.IntVar()
self.progress_bar = Progressbar(self.progress_frame, variable=self.progress_value)
self.button_frame = Frame(self)
self.process_button = ProcessButton(parent=self.button_frame, start_jobs=self.start_jobs)
self.quit_button = QuitButton(parent=self.button_frame, close_other_windows=self.close_top_level_windows)
self.run_job = kwargs['run_job'] if 'run_job' in kwargs else None
self.create_plots = kwargs['create_plots'] if 'create_plots' in kwargs else None
self.log_filename = kwargs['log_filename'] if 'log_filename' in kwargs else None
self.bind('<<AskToClearJobs>>', self.ask_to_clear_jobs)
self.bind('<<AskToPlotGraphs>>', self.ask_to_plot_graphs)
self.bind('<<CreatePlotGUI>>', self.create_plot_gui)
self.parent.bind('<ButtonPress>', self.on_press)
self.parent.bind('<Configure>', self.on_resize)
self.reinit_variables()
self.top_level_windows = list()
# NOTE: Because there seems to be an issue resizing child widgets when the top level (Tk) widget is being resized,
# the resize option will be disabled for this window
self.parent.resizable(width=False, height=False)
self.lift()
def reinit_variables(self):
self.job_params = dict()
self.last_job_id = -1
self.job_outcomes = list()
self.plot_args = list()
self.on_button = False
def add_job_params(self, input_args):
self.job_params = input_args
# Add each element to the job list
for job in self.job_params:
self.add_job(job)
def add_job(self, job):
try:
index_end = job['input_directory'].rindex('/')
index_start = job['input_directory'].rindex('/', 0, index_end)
input_directory_text = job['input_directory']
list_text = 'Job ' + str(job['job_id']) + ' \'' + input_directory_text + '\''
if job['start'] != None:
list_text += ' ' + str(job['start'])
if job['end'] != None:
list_text += ' to'
if job['end'] != None:
list_text += ' ' + str(job['end'])
if job['job_id'] > self.last_job_id:
self.last_job_id = job['job_id']
self.job_list.insert(Tkinter.END, list_text)
# Add the list text to the job params as an optional parameter to read later to display in a future Graph GUI (or for any other useful purpose)
job['list_text'] = list_text
# The line number is used wrt the GUI to indicate which job in the job list is being currently executed.
job['line_number'] = self.job_list.size() - 1
#print str(job['line_number'])
self.job_params[job['job_id']] = job
except KeyError as ke:
# Should show some error message indicating that there is a problem.
pass
#print str(self.job_params)
#print 'Added Job ' + str(job['job_id'])
def ask_to_clear_jobs(self, event):
#.........这里部分代码省略.........
开发者ID:jhavstad,项目名称:model_runner,代码行数:101,代码来源:ModelRunnerGUI.py
示例20: MPExportApp
class MPExportApp(object):
"""docstring for MPExportApp"""
def __init__(self, master):
super(MPExportApp, se
|
请发表评论