def __init__(self, root=None): self.root = root self.name = "browsefile" # Input Frame self.Container = ttk.LabelFrame(root, text=" Select File ") self.Container.pack(side='top', anchor='n', fill='x', expand='yes', padx=5, pady=5) # Default filetypes self.FILEOPENOPTIONS = dict(defaultextension='*.*', filetypes=[('All files', '*.*')]) # Browse Entry self.fileVar = tk.StringVar() self.fileEntry = ttk.Entry(self.Container, width=30) self.fileEntry.pack(side='left', anchor='nw', fill='x', expand='yes', padx=5, pady=5) # TODO: Copy/paste # Browse Button try: # Use the folder icon self.opengif = tk.PhotoImage(file=OPENFOLDER) self.browseBut = ttk.Button(self.Container, command=self._browse) self.browseBut.config(image=self.opengif) except: # Use an elipse self.browseBut = ttk.Button(self.Container, text=" ... ", command=self._browse) self.browseBut.pack(side='right', anchor='ne', padx=5, pady=5)
def __init__(self, root): ttk.Frame.__init__(self, f3) self.root = f3 self.queryframe = ttk.Frame(self.root, relief=SUNKEN) self.queryframe.pack(fill=BOTH, expand=1) global select select = Listbox(self.queryframe, height=4) self.select = select # global canvas # canvas = Canvas(self.queryframe) # self.canvas = canvas global sel_query sel_query = ['Variant','Sample','Gene', 'Transcript'] self.select.delete(0,END) for item in sel_query: self.select.insert(END, item) global in_val in_val = StringVar() self.in_val_entry = ttk.Entry(self.queryframe, width=20, textvariable=in_val) self.in_val_lab = ttk.Label(self.queryframe, text="Value") self.select_but = ttk.Button(self.queryframe, text="Search", command=select_query) #self.freq_but = ttk.Button(self.queryframe, text="Search", command=frequency_query) # Grid self.select.grid(column=0, row=0, rowspan=4) # self.canvas.grid(column=0 , row=3 , columnspan=10 , rowspan=10 ) self.in_val_entry.grid(column=3, row=5, sticky=(W, E)) self.in_val_lab.grid(column=0, row=5, sticky=W) self.select_but.grid(column=5, row=5) #self.freq_but.grid(column=7, row=2, rowspan=2, columnspan=2) for child in self.queryframe.winfo_children(): child.grid_configure(padx=5, pady=5)
def __init__(self, parent): ttk.Frame.__init__(self, parent) self.parent = parent RemoveButton(self, command=self.remove).pack(side="left", padx=5) ttk.Label(self, text="Quantity: ").pack(side="left") self.robotAmountInput = ttk.Entry(self, width=5, validate="key") self.robotAmountInput['validatecommand'] = ( self.robotAmountInput.register(validateInt), '%P', '%i', '%d') self.robotAmountInput.insert(0, "1") self.robotAmountInput.pack(side="left") self.robotFilename = tkFileDialog.askopenfilename( title="Select Robot's Program", filetypes=[("Gubi High Level Code", "*.gubic"), ("Gubi Assembly", "*.gubi "), ("All files", "*")]) if not self.robotFilename: configWindow.after(0, self.remove) ttk.Label(self, text=" ..." + self.robotFilename[-20:]).pack(side="right")
48 def __init__(self, top=None): 49 '''This class configures and populates the toplevel window. 50 top is the toplevel containing window.''' 51 _bgcolor = '#d9d9d9' # X11 color: 'gray85' 52 _fgcolor = '#000000' # X11 color: 'black' 53 _compcolor = '#d9d9d9' # X11 color: 'gray85' 54 _ana1color = '#d9d9d9' # X11 color: 'gray85' 55 _ana2color = '#ececec' # Closest X11 color: 'gray92' 56 self.style = ttk.Style() 57 if sys.platform == "win32": 58 self.style.theme_use('winnative') 59 self.style.configure('.',background=_bgcolor) 60 self.style.configure('.',foreground=_fgcolor) 61 self.style.configure('.',font="TkDefaultFont") 62 self.style.map('.',background= 63 [('selected', _compcolor), ('active',_ana2color)]) 64 65 top.geometry("242x168+344+142") 66 top.title("New Toplevel") 67 top.configure(background="#d9d9d9") 68 69 self.TEntry1 = ttk.Entry(top) 70 self.TEntry1.place(relx=0.207, rely=0.238, relheight=0.125 71 , relwidth=0.529) 72 self.TEntry1.configure(takefocus="") 73 self.TEntry1.configure(cursor="ibeam") 74 75 self.TButton1 = ttk.Button(top) 76 self.TButton1.place(relx=0.124, rely=0.536, height=24, width=77) 77 self.TButton1.configure(takefocus="") 78 self.TButton1.configure(text='''Tbutton''') 79 80 self.TButton2 = ttk.Button(top) 81 self.TButton2.place(relx=0.496, rely=0.536, height=24, width=77) 82 self.TButton2.configure(takefocus="") 83 self.TButton2.configure(text='''Tbutton''') 84 85 if __name__ == '__main__': 86 vp_start_gui()
def create_binding_ui(self): for bind_number in range(2): # Bind frame binding_frame = ttk.Frame(self) binding_frame.grid(row=bind_number + 2, column=1, stick='W', padx=20) # Variables binding_var = Tkinter.StringVar() self.widget_variables['binding_%i' % bind_number] = binding_var # Bind label binding_label_widget = ttk.Label(binding_frame, text='N/A', width=25) binding_label_widget.pack(side='left') self.widget_variables['binding_label_widget_%i' % bind_number] = binding_label_widget # Create a button widget and bind it to bind_button_callback # This will configure the label text and setup the hotkey bind_callback = functools.partial(self.bind_button_callback, bind_number) button_widget = ttk.Button(binding_frame, text='Bind', command=bind_callback) button_widget.pack(side='left') # Label and entry for value ttk.Label(binding_frame, text='Value').pack(side='left') ttk.Entry(binding_frame, width=7, textvariable=binding_var).pack(side='left') value_callback = functools.partial(self.bind_value_callback, bind_number) binding_var.trace('w', value_callback) # end for return
def __init__(self, parent): self.parent = parent self.sb1 = Scrollbar(self.tb, orient=VERTICAL) self.sb2 = Scrollbar(self.tb, orient=HORIZONTAL) self.tb.configure(yscrollcommand=self.sb1.set) self.tb.configure(xscrollcommand=self.sb2.set) self.sb1.config(command=self.tb.yview) self.sb2.config(command=self.tb.xview) self.tb.grid(column= 1, row=9, columnspan=20,rowspan=6, sticky=(N, W, E, S) ) self.tb.columnconfigure(0, weight=1) self.tb.rowconfigure(0, weight=1) self.sb1.grid(column=6, row=0, sticky=(E, S)) self.sb2.grid(column=0, row=6, sticky=(E,S)) self.select.grid(column=1, row=1, columnspan=2) global sel_query sel_query = ['Variant','Sample','Gene', 'Transcript'] self.select.delete(0,END) for item in sel_query: self.select.insert(END, item) global in_val in_val = StringVar() self.in_val_entry = ttk.Entry(self.queryframe, width=20, textvariable=in_val) self.in_val_entry.grid(column=3, row=2, rowspan=2, columnspan=2, sticky=(W, E)) self.in_val_lab = ttk.Label(self.queryframe, text="Value") self.in_val_lab.grid(column=3, row=1, rowspan=2, columnspan=3, sticky=W) self.select_but = ttk.Button(self.queryframe, text="Search", command=select_query) self.select_but.grid(column=5, row=2, rowspan=2, columnspan=2) self.freq_but = ttk.Button(self.queryframe, text="Search", command=frequency_query) self.freq_but.grid(column=7, row=2, rowspan=2, columnspan=2) for child in self.queryframe.winfo_children(): child.grid_configure(padx=5, pady=5)
def createLBox(key, curt): global specY global numMade global atxtbox self.TLabel1 = ttk.Label(top) self.TLabel1.place(relx=0.0, y=specY, height=25, width=200) self.TLabel1.configure(background="#d9d9d9") self.TLabel1.configure(foreground="#000000") self.TLabel1.configure(font="TkDefaultFont") self.TLabel1.configure(relief=FLAT) self.TLabel1.configure(text=key) self.TLabel1.configure(wraplength="200") self.TEntry1 = ttk.Entry(top) self.TEntry1.place(relx=0.4, y=specY, height=25, relwidth=0.6) self.TEntry1.configure(takefocus="") self.TEntry1.configure(width=405) self.TEntry1.configure(cursor="ibeam") self.TEntry1.configure(textvariable=curt[key]) atxtbox[key] = self.TEntry1 numMade = numMade + 1 specY = specY + 25
def __init__(self, parentFrame, parentClass, armyNumber, removable): ttk.Frame.__init__(self, parentFrame) self.parent = parentClass self.robots = [] self.armyTitleFrame = ttk.Frame(self) RemoveButton(self.armyTitleFrame, removable, command=self.remove).pack(side="left", padx=5) self.armyLabel = ttk.Label(self.armyTitleFrame, text="Army name: ") self.armyLabel.pack(side="left") self.addRobotButton = ttk.Button(self.armyTitleFrame, text="Add Robots", command=self.addRobot) self.addRobotButton.pack(side="right") self.armyNameEntry = ttk.Entry(self.armyTitleFrame) self.armyNameEntry.insert(0, "Army " + str(armyNumber)) self.armyNameEntry.pack(side="right", fill="x", padx=10, expand=True) self.armyTitleFrame.pack(side="top", fill="x")
def add_variable(Variable_name='', Varible_value=''): def delete_variable(): variable_name.destroy() variable_value.destroy() varialve_delete_butotn.destroy() variables.pop(variable_name) global r varialve_delete_butotn = ttk.Button(in_canvas_variables_frame, text='X', command=delete_variable) varialve_delete_butotn.grid(row=r) variable_name = ttk.Combobox(in_canvas_variables_frame, values=experiment.Ordered_supported_parameters.keys(), state="readonly") if Variable_name != '': variable_name.current(Variable_name) variable_name.grid(row=r, column=1) variable_value = ttk.Entry(in_canvas_variables_frame) variable_value.grid(row=r, column=2, sticky='E W') variable_value.insert(tk.END, Varible_value) variables[variable_name] = variable_value r+=1
def __init__(self, error_message=None): self.token = None root = self.root = Tk() self.error_message = StringVar(root) root.title("UC Scout Token") root.bind('<Return>', self.ok) frame = ttk.Frame(root) frame.grid(column=0, row=0, sticky=('n', 'e', 's', 'w')) message = 'A UC Scout token is required to access grades from UC Scout. Please consult the documentation for ' \ 'instructions on creating a token. ' ttk.Label(frame, text=message, wraplength=400).grid(row=0, column=0) vcmd = (frame.register(self.validate), '%P', '%W') self.e = ttk.Entry(frame, show="*", width=45, validate='key', validatecommand=vcmd) self.e.grid(row=1, column=0, padx=5) self.e.focus_set() self.error_label = ttk.Label(frame, textvariable=self.error_message, wraplength=400, foreground='red') self.error_label.grid(row=2, column=0) if error_message: self.error_message.set(error_message) else: self.error_label.grid_forget() self.ok_button = ttk.Button(frame, text="OK", command=self.ok, state=DISABLED) self.ok_button.grid(row=3, column=0, pady=5)
def _build_search_frame(self): self.search_frame = ttk.LabelFrame(self, text="Search") self.search_frame.grid(row=0, column=0, sticky="ew", pady=15) self.search_pcode_stvar = tk.StringVar() self.search_pcode_stvar.set("P000BAZV") self.search_pcode_label = ttk.Label(self.search_frame, text="Search") self.search_pcode_label.grid(row=0, column=0) self.search_type_var = tk.StringVar() self.search_type_menu = ttk.Combobox( self.search_frame, textvariable=self.search_type_var, width=17, values=["Product Code", "Barcode"], state="readonly") self.search_type_menu.grid(row=0, column=1, columnspan=1, pady=(5, 5), sticky="w", padx=(5, 5)) self.search_type_menu.bind('<<ComboboxSelected>>', self.selclear) self.search_type_menu.current(0) self.search_type_menu.selection_clear() self.search_entry = ttk.Entry(self.search_frame, width=15, textvariable=self.search_pcode_stvar) self.search_entry.grid(row=0, column=2, padx=5, sticky="w") self.search_button = ttk.Button(self.search_frame, text="Search", command=self.search_product) self.search_button.grid(row=0, column=3, padx=5, sticky="w")
def Choices(self): """Set up window to select BLAST program and database.""" self.blast_string = tk.StringVar() self.blast_string.set("blastn") self.cf = ttk.Frame(self.toplevel) self.cf.pack(side="top", expand=1, fill="x") self.dbs_frame = ttk.LabelFrame(self.cf, text="Databases") self.dbs_frame.pack(side="left", padx=5, pady=5, expand=1, fill="x") nin_values = self.database_readable(self.nin) pin_values = self.database_readable(self.pin) self.dbs = ttk.Combobox(self.dbs_frame, exportselection=0, values=nin_values + pin_values) self.dbs.current(0) self.blast_frame = ttk.LabelFrame(self.cf, text="BLAST programs") self.blast_frame.pack(side="left", padx=5, pady=5, expand=1, fill="x") self.blasts = ttk.Combobox( self.blast_frame, exportselection=0, textvariable=self.blast_string, values=["blastn", "blastp", "blastx", "tblastn", "tblastx"], ) self.dbs.pack(side="left", padx=5, pady=5, expand=1, fill="x") self.blasts.pack(side="left", padx=5, pady=5, expand=1, fill="x") self.option_f = ttk.LabelFrame(self.cf, text="Command line options") self.option_f.pack(side="left", padx=5, pady=5, expand=1, fill="x") self.option = ttk.Entry(self.option_f) self.option.pack(side="left", padx=5, pady=5, fill="x", expand=1) self.ok = ttk.Button(self.cf, text="Run", command=self._Run, state="disabled") self.ok.pack(side="right") self.Validate()
def __init__(self, master, instrument, can): self.i = instrument self.can = can self.master = master Toplevel.__init__(self) self.mainFrame = ttk.Frame(self) self.mainFrame.grid() self.timeCan = TimeCanvas(self.mainFrame, width=400, height=70) self.timeCan.grid() self.PMFrame = ttk.Frame(self.mainFrame) self.PMFrame.grid(row=0, column=1, sticky=N) #self.sLabel = ttk.Label(self.PMFrame, textvariable = self.labelSubs) #self.sLabel.grid(row = 0, column = 0) self.pButton = ttk.Button(self.PMFrame, text="+", command=self.timeCan.addSub) self.pButton.grid(row=1, column=0) self.mButton = ttk.Button(self.PMFrame, text="-", command=self.timeCan.subSub) self.mButton.grid(row=2, column=0) self.buttonFrame = ttk.Frame(self.mainFrame) self.buttonFrame.grid(row=1, column=0, sticky=EW) self.tEntry = ttk.Entry(self.buttonFrame) self.tEntry.grid(row=0, column=0) self.tEntry.insert(0, "0") self.goButton = ttk.Button(self.buttonFrame, text="Set Cue", command=self.setCue) self.goButton.grid(row=0, column=1)
def configure_contribution(idx): global w, contributions assert idx >= 0 assert idx < len(contributions) # remove extra edit areas while len(w.edContribs[idx]) > contributions[idx].number_of_params: w.edContribs[idx][-1].destroy() w.edContribs[idx].pop() # add new edit areas while len(w.edContribs[idx]) < contributions[idx].number_of_params: j = len(w.edContribs[idx]) w.edContribs[idx].append(ttk.Entry(w.contribs_frame)) w.edContribs[idx][j].place(x=85+45*j, y=30+25*idx, width=45) w.edContribs[idx][j].insert(0, '0') # add new material check box if hasattr(contributions[idx], 'set_material'): if w.cbContribMats[idx] is None: w.cbContribMats[idx] = ttk.Combobox(w.contribs_frame) j = len(w.edContribs[idx]) w.cbContribMats[idx].place(x=85+45*j, y=30+25*idx, width=55) update_materials_tree() elif w.cbContribMats[idx] is not None: w.cbContribMats[idx].destroy() w.cbContribMats[idx] = None # add button for extra plots if hasattr(contributions[idx], 'plot_distrib'): if w.btContribDistribPlots[idx] is None: w.btContribDistribPlots[idx] = ttk.Button(w.contribs_frame, text='P', image=w.imPlot2) w.btContribDistribPlots[idx].contribution_idx = idx j = len(w.edContribs[idx]) w.btContribDistribPlots[idx].bind('<Button-1>', btPlotContribDistribClick) # idx not work if passed as command in constructor w.btContribDistribPlots[idx].bind('<Return>', btPlotContribDistribClick) # so more events w.btContribDistribPlots[idx].bind('<Key>', btPlotContribDistribClick) # should be proceeded w.btContribDistribPlots[idx].place(relx=1.0, x=-55, y=25+25*idx, height=25, width=25) elif w.btContribDistribPlots[idx] is not None: w.btContribDistribPlots[idx].destroy() w.btContribDistribPlots[idx] = None
def chooseSampleSize(): # Allow the user to choose the sample size of displayed values sampleSizeQ =tk.Tk() sampleSizeQ.wm_title('Sample size?') label = ttk.Label(sampleSizeQ, text = "Specify the sample size of displayed values.") label.pack(side="top", fill="x", pady=10) e = ttk.Entry(sampleSizeQ) e.insert(0,sampleSize) e.pack() e.focus_set() def callback(): global sampleSize sampleSize = int(e.get()) print('Sample size is now {}'.format(sampleSize)) sampleSizeQ.destroy() ## e.bind("<Return>", callback) b = ttk.Button(sampleSizeQ, text='Submit', width=10, command=callback) b.pack() tk.mainloop()
def createWidgets(self): # Convert the Image object into a TkPhoto tkimage = PhotoImage(file="/home/spirit/logo.png") self.logo = ttk.Label(self, image=tkimage) self.logo.image = tkimage self.logo.pack() self.welcome = ttk.Label( self, text="Welcome to JotForm Uploaded Files Downloader") self.welcome.pack(padx=5, pady=10) self.statusText = ttk.Label( self, text="Please enter your JotForm API Key to start") self.statusText.pack(padx=5, pady=5) self.keyEntry = ttk.Entry(self, textvariable=self.apiKey) self.keyEntry.pack(padx=5, pady=5) self.initButton = ttk.Button(self, text="Start", command=self.getForms) self.initButton.pack(padx=5, pady=5) self.progress = 0 self.progressbar = ttk.Progressbar(mode="determinate") self.progressbar.pack(side="bottom", fill="x")
def __init__(self, master, instrument, can): self.i = instrument self.can = can self.master = master Toplevel.__init__(self) self.mainFrame = ttk.Frame(self) self.mainFrame.grid() self.boxVal = StringVar() self.lBox = ttk.Combobox(self.mainFrame, textvariable=self.boxVal, width=10) self.lBox['values'] = ("cue", "rate", "gain") self.lBox.current(0) self.lBox.grid() self.lEntry = ttk.Entry(self.mainFrame, width=5) self.lEntry.grid(row=0, column=1) self.lSet = ttk.Button(self.mainFrame, text="Apply", command=self.apply) self.lSet.grid(row=0, column=2)
def __init__(self, parent, variable): TK.Frame.__init__(self, parent) self.__radio = ttk.Radiobutton(self, text="NEW REVIEW", variable=variable, value=self.ID) self.__radio self.__radio.grid(row=0, column=0, columnspan=2, sticky=TK.W) # self.__radio.pack(side=TK.TOP, ipadx=3) label = ttk.Label(self, text="Title", font=CONST.LARGE_FONT) label.grid(row=1, column=0) self.__code_review_title = TK.StringVar() self.__code_review_title.set("Code review title") text = ttk.Entry(self, font=CONST.LARGE_FONT, textvariable=self.__code_review_title) text.grid(row=1, column=1) self.pack(anchor=TK.NW, fill=TK.X, padx=5, pady=5)
def __init__(self, parent, *args, **kw): ''' Inicializa un frmScrollPane con scroll y crea la cabezera de la tabla ''' ttk.Frame.__init__(self, parent, *args, **kw) self.lstImgsFiltradas = [] self.lstImgsSeleccionadas = [] self.boolVarVerImgs = tk.BooleanVar() self.boolVarVerImgs.set(tk.FALSE) self.expRegBusqueda = tk.StringVar() ttk.Entry(self, textvariable=self.expRegBusqueda).pack(fill = tk.X) self.iconoBusqueda = Image.open("../Imgs/iconoBusqueda.png") self.iconoBusqueda.thumbnail((20,20), Image.ANTIALIAS) self.iconoBusqueda = ImageTk.PhotoImage(self.iconoBusqueda) ttk.Button(self, image=self.iconoBusqueda, command=self.buscar).pack(fill = tk.X) self.frmScrollPane = ScrolledFrame(self) self.frmScrollPane.pack(fill = tk.BOTH, expand = True) self.cambiarDeClase(Accion.nomClaseDefault)
def create_widgets(self): def print_word(event): self.word_holder2.destroy() self.word_holder2 = ttk.Frame(self.word_holder) self.word_holder2.pack() elements = periodic.get_periodics(self.word.get()) for match in elements: holder = ttk.Label(self.word_holder2) for el in match: ElementLabel(holder, el).pack(side=Tkinter.LEFT, padx=5, pady=5) holder.pack() self.word = Tkinter.StringVar() entry = ttk.Entry(self, textvariable=self.word) entry.bind("<KeyRelease>", print_word) entry.pack() self.word_holder = ttk.Frame(self) self.word_holder.pack() self.word_holder2 = ttk.Frame(self.word_holder) self.word_holder2.pack()
def create_buttons(self, parent): self.button_frame = ttk.Frame(parent) self.button_frame.pack(fill='y', side='left') self.buttons = {} for text, func in [('Open', self.open), ('Export', self.export), ('GC Frame', self.gcframe), ('Blast', self.blast), ('Exit', self.exit)]: b_id = ttk.Button(self.button_frame, text=text, command=func, width=7) b_id.pack(side='top', pady=5, padx=10) self.buttons[text] = b_id frame = ttk.Frame(self.button_frame) label = ttk.Label(frame, text='Goto:') label.pack(side='left') label.bind('<Button-1>', self.goto) self.goto_entry = ttk.Entry(frame, width=5) self.goto_entry.pack(side='right', pady=5, padx=4) self.goto_entry.bind('<Return>', self.goto) frame.pack(side='bottom')
def importDirFrame(): dirFrame = ttk.Frame(root, padding="3 3 12 12") dirFrame.grid(column=0, row=0, sticky=(N, W, E, S)) dirFrame.columnconfigure(0, weight=1) dirFrame.rowconfigure(2, weight=1) ttk.Label(dirFrame, text="Select a directory where you want to run the QMD").grid( column=2, row=1, sticky=(W, E), rowspan=2) ttk.Entry(dirFrame, width=7, textvariable=dirName).grid(column=2, row=3, sticky=(W, E)) ttk.Button(dirFrame, text="SelectDirectory", command=lambda: selDirectory(dirFrame)).grid(column=6, row=3, sticky=W) ttk.Button(dirFrame, text="Next", command=lambda: loadFrame('e', 1)).grid(column=2, row=10, sticky=W) dirName.set("") for child in dirFrame.winfo_children(): child.grid_configure(padx=5, pady=5)
def __init__(self, parent, log, proj): ttk.Frame.__init__(self, parent) self.task = ServerTask(proj) self.log = log self.port_var = tk.StringVar() self.port_var.set(self.task.port) port_label = ttk.Label(self, text="Port:") port_label.grid(row=1, column=1, sticky='NESW') self.port_entry = ttk.Entry(self, textvariable=self.port_var, width=5) self.port_entry.grid(row=1, column=2, sticky='NESW') self.start_button = ttk.Button(self) self.start_button.grid(row=1, column=3, rowspan=2, sticky='NESW') self.browser_button = ttk.Button(self, text="Open in browser", command=self.openBrowser) self.browser_button.grid(row=2, column=1, columnspan=2, sticky='NESW') self.enableStartServer() if proj.config.get(['Autostart-Server']): self.startServer()
def updateEditBox(self, item): if self.editItem == None or item != self.editItem[1]: self.editFrame.pack_forget() for w in self.editFrameItems: w.destroy() self.editFrameItems = [] self.editFrameLabel.pack() #create edit box items if isinstance(item, (bool, int, str, float, unicode)): e = ttk.Entry(self.editFrame) e.bind('<Return>', self.itemEdited) e.delete(0, END) e.insert(0, str(item)) e.pack() self.editFrameItems.append(e) elif isinstance(item, (dict, list)): pass self.editFrame.pack(side=RIGHT, fill=BOTH, expand=1) else: #modify edit box items if isinstance(item, (bool, int, str, float, unicode)): self.editFrameItems[0].delete(0, END) self.editFrameItems[0].insert(0, str(item))
def __init__(self, master): self.master = master self.master.title("Delete a host") mainframe = ttk.Frame(self.master, padding="3 3 12 12") mainframe.grid(column=0, row=0, sticky=(N, W, E, S)) mainframe.columnconfigure(0, weight=1) mainframe.rowconfigure(0, weight=1) HOST_ID = StringVar() ttk.Label(mainframe, text="Delete host").grid(column=1, row=1, sticky=W) ttk.Label(mainframe, text="HOST ID").grid(column=1, row=2, sticky=W) HOST_ID_entry_box = ttk.Entry(mainframe, width=39, textvariable=HOST_ID) HOST_ID_entry_box.grid(column=2, row=2, sticky=W) ttk.Button(mainframe, text="Delete", command=lambda: self.delete_host(HOST_ID)).grid(column=2, row=6, sticky=W) for child in mainframe.winfo_children(): child.grid_configure(padx=5, pady=5)
def initialize(self): """ Set window layout. """ self.grid() self.respond = ttk.Button(self, text='Get Response', command=self.get_response) self.respond.grid(column=1, row=0, sticky='nesw', padx=3, pady=3) self.usr_input = ttk.Entry(self, state='normal') self.usr_input.grid(column=0, row=0, sticky='nesw', padx=3, pady=3) self.conversation = ScrolledText.ScrolledText(self, state='disabled') self.conversation.grid(column=0, row=2, sticky='nesw', padx=10, pady=10) #image self.load = Image.open("trumppet.png") self.render = ImageTk.PhotoImage(self.load) self.img = ttk.Label(self, image=self.render, background='orange') self.img.grid(column=1, row=2)
def __init__(self, parent, root, Listbox): ttk.Frame.__init__(self, parent) self.root = root self.Listbox = Listbox label1 = ttk.Label(self, text="Edit", font=font_title) label1.pack(side="top", fill="x", pady=7, padx=10) self.label1 = ttk.Label(self, text="Enter the name:", font=font_message) self.label1.pack(side="top") self.entry1 = ttk.Entry(self) self.entry1.pack(side="top") self.label0 = ttk.Label(self, text=" ", font=font_message) self.label0.pack(side="top") self.label2 = ttk.Label(self, text=" ", font=font_message) self.label2.pack(side="top") self.frame1 = ttk.Frame(self, width=480, height=320) self.frame1.pack(side="top", pady=30, padx=15) self.keysize = 4 self.entry1.bind("<FocusIn>", lambda e: self.show_vKeyboard()) self.kb = vKeyboard(parentPage=self, attach=self.entry1, x=self.entry1.winfo_rootx(), y=self.entry1.winfo_rooty() + self.entry1.winfo_reqheight(), keysize=self.keysize, parent=self.frame1, root=self.root, Listbox=self.Listbox)
def Choices(self): """Set up window to select BLAST program and database.""" self.blast_string = tk.StringVar() self.blast_string.set('blastn') self.cf = ttk.Frame(self.toplevel) self.cf.pack(side='top', expand=1, fill='x') self.dbs_frame = ttk.LabelFrame(self.cf, text='Databases') self.dbs_frame.pack(side='left', padx=5, pady=5, expand=1, fill='x') nin_values = self.database_readable(self.nin) pin_values = self.database_readable(self.pin) self.dbs = ttk.Combobox(self.dbs_frame, exportselection=0, values=nin_values + pin_values) self.dbs.current(0) self.blast_frame = ttk.LabelFrame(self.cf, text='BLAST programs') self.blast_frame.pack(side='left', padx=5, pady=5, expand=1, fill='x') self.blasts = ttk.Combobox( self.blast_frame, exportselection=0, textvariable=self.blast_string, values=['blastn', 'blastp', 'blastx', 'tblastn', 'tblastx']) self.dbs.pack(side='left', padx=5, pady=5, expand=1, fill='x') self.blasts.pack(side='left', padx=5, pady=5, expand=1, fill='x') self.option_f = ttk.LabelFrame(self.cf, text='Command line options') self.option_f.pack(side='left', padx=5, pady=5, expand=1, fill='x') self.option = ttk.Entry(self.option_f) self.option.pack(side='left', padx=5, pady=5, fill='x', expand=1) self.ok = ttk.Button(self.cf, text='Run', command=self._Run, state='disabled') self.ok.pack(side='right') self.Validate()
def __init__(self, master): self.master = master self.master.title("Welcome to Dashboard") self.master.geometry("380x55+200+200") self.master.resizable(False, False) self.dashboard_window = None self.launcher_header = ttk.Frame(master) self.launcher_header.pack() ttk.Label(self.launcher_header, text="Enter Your Location or Postcode", padding=2).pack() self.launcher_input_frame = ttk.Frame(master) self.launcher_input_frame.pack() self.input_var = tk.StringVar() self.user_input = ttk.Entry(self.launcher_input_frame, textvariable=self.input_var, width=15) self.user_input.pack(side=tk.LEFT, ipadx=25) self.start_b = ttk.Button(self.launcher_input_frame, text="Start", command=self.launch_dashboard) self.start_b.pack(side=tk.LEFT, padx=10) self.stop_b = ttk.Button(self.launcher_input_frame, text="Stop", state=tk.DISABLED, command=self.quit_dashboard) self.stop_b.pack(side=tk.RIGHT)
def __init__(self, parent, controller): tk.Frame.__init__(self, parent) #creating a label label = ttk.Label(self, text="Enter the node to be recover", font=("Helvetica", 28)) label.pack(pady=10, padx=10) entry = ttk.Entry(self, width=10) entry.pack(pady=10, padx=10) #creating buttons #click the button to remove the node taken as input from user to the network button = ttk.Button(self, text="Recover Node", command=lambda: controller.recover_node(entry)) button.pack(pady=10, padx=10) #click button to go back to selection page frame butt = ttk.Button( self, text="Back to Selection Page", command=lambda: controller.show_frame(selection_page)) butt.pack() #click button to go back to home page frame butt_1 = ttk.Button(self, text="Back to Home", command=lambda: controller.show_frame(StartPage)) butt_1.pack(pady=10, padx=10)