def initUI(self): self.title('CP Noise Parameters') self.columnconfigure(0, pad=1) self.columnconfigure(1, pad=1) self.columnconfigure(2, pad=1) self.rowconfigure(0, pad=10) self.rowconfigure(1, pad=1) self.rowconfigure(2, pad=6) label1 = Label(self, text='Corner Frequency [kHz]') self.entry_fc = Entry(self, width=8) self.entry_fc.insert(END, str(self.parent.cp_fc.get() / 1.0e3)) label1.grid(row=0, column=0, sticky=W) self.entry_fc.grid(row=0, column=1, sticky=W) label2 = Label(self, text='Noise slope [dB/dec]') self.entry_slope = Entry(self, width=8) self.entry_slope.insert(END, str(self.parent.cp_slope.get())) label2.grid(row=1, column=0, sticky=W) self.entry_slope.grid(row=1, column=1, sticky=W) button_OK = Button(self, text='OK', command=self.on_OK, width=10) button_Apply = Button(self, text='Apply', command=self.on_Apply, width=10) button_Quit = Button(self, text='Quit', command=self.on_Quit, width=10) button_OK.grid(row=2, column=0, sticky=W + E + S) button_Apply.grid(row=2, column=1, sticky=W + E + S) button_Quit.grid(row=2, column=2, sticky=W + E + S)
def initUI(self): self.parent.title("Review") self.pack(fill=BOTH, expand=True) frame1 = Frame(self) frame1.pack(fill=X) lbl1 = Label(frame1, text="Title", width=6) lbl1.pack(side=LEFT, padx=5, pady=5) entry1 = Entry(frame1) entry1.pack(fill=X, padx=5, expand=True) frame2 = Frame(self) frame2.pack(fill=X) lbl2 = Label(frame2, text="Author", width=6) lbl2.pack(side=LEFT, padx=5, pady=5) entry2 = Entry(frame2) entry2.pack(fill=X, padx=5, expand=True) frame3 = Frame(self) frame3.pack(fill=BOTH, expand=True) lbl3 = Label(frame3, text="Review", width=6) lbl3.pack(side=LEFT, anchor=N, padx=5, pady=5) txt = Text(frame3) txt.pack(fill=BOTH, pady=5, padx=5, expand=True)
def initUI(self): self.parent.title("User Control Panel") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) self.label = Label(self, text="Mobile Live Bus Tracker", font=('Helvetica', '21')) self.label.grid(row=0, column=0) self.l = Label(self, text="My Location", font=('Helvetica', '18')) self.l.grid(row=1, column=0) self.e = Entry(self, font=('Helvetica', '18')) self.e.grid(row=2, column=0) self.l = Label(self, text="Destination", font=('Helvetica', '18')) self.l.grid(row=3, column=0) # add vertical space self.l = Label(self, text="", font=('Helvetica', '14')) self.l.grid(row=5, column=0) self.e = Entry(self, font=('Helvetica', '18')) self.e.grid(row=4, column=0) self.search = Button(self, text="Search") self.search.grid(row=6, column=0) # For second screen (after user searched) # add vertical space self.l = Label(self, text="", font=('Helvetica', '14')) self.l.grid(row=7, column=0) self.l = Label(self, text="Pick a bus line", font=('Helvetica', '18')) self.l.grid(row=8, column=0) self.search = Button(self, text="61A", width=40) self.search.grid(row=9, column=0) self.search = Button(self, text="61B", width=40) self.search.grid(row=10, column=0) self.search = Button(self, text="61C", width=40) self.search.grid(row=11, column=0) ############## used for debug ################ self.l2 = Label(self, text="", font=('Helvetica', '14')) self.l2.grid(row=12, column=0) self.turnOnBtn = Button(self, text="Turn On") self.turnOnBtn["command"] = self.turnOn self.turnOnBtn.grid(row=13, column=0) self.reqBtn = Button(self, text="Request") self.reqBtn["command"] = self.request self.reqBtn.grid(row=14, column=0) self.turnOffBtn = Button(self, text="Turn Off") self.turnOffBtn["command"] = self.turnOff self.turnOffBtn.grid(row=15, column=0)
def __init__(self): self.root = Tk() self.root.title(u'登录') self.root.resizable(False, False) self.root.geometry('+450+250') self.sysfont = Font(self.root, size=15) self.lb_user = Label(self.root, text=u'用户名:', width=20, height=10, font=("黑体", 15, "bold")) self.lb_passwd1 = Label(self.root, text=u'') self.lb_passwd = Label(self.root, text=u'密码:', width=20, height=5, font=("黑体", 15, "bold")) self.lb_user.grid(row=0, column=0, sticky=W) self.lb_passwd1.grid(row=1, column=0, sticky=W) self.lb_passwd.grid(row=2, column=0, sticky=W) self.en_user = Entry(self.root, font=self.sysfont, width=24) self.en_passwd = Entry(self.root, font=self.sysfont, width=24) self.en_user.grid(row=0, column=1, columnspan=1) self.en_passwd.grid(row=2, column=1, columnspan=1) self.en_user.insert(0, u'请输入用户名') self.en_passwd.insert(0, u'请输入密码') self.en_user.config( validate='focusin', validatecommand=lambda: self.validate_func('self.en_user'), invalidcommand=lambda: self.invalid_func('self.en_user')) self.en_passwd.config( validate='focusin', validatecommand=lambda: self.validate_func('self.en_passwd'), invalidcommand=lambda: self.invalid_func('self.en_passwd')) self.var = IntVar() self.ckb = Checkbutton(self.root, text=u'记住用户名和密码', underline=0, variable=self.var, font=(15)) self.ckb.grid(row=3, column=0) self.bt_print = Button(self.root, text=u'登陆') self.bt_print.grid(row=3, column=1, sticky=E, pady=50, padx=10) self.bt_print.config(command=self.print_info) self.bt_http = Button(self.root, text=u'http登录') self.bt_http.grid(row=3, column=2, sticky=E, pady=50, padx=50) self.bt_http.config(command=self.http_info) self.bt_register = Button(self.root, text=u'注册') self.bt_register.grid(row=3, column=3, sticky=E, pady=50, padx=50) self.bt_register.config(command=self.register_info) self.root.mainloop()
def initUI(self): self.parent.title("Sequence modification parser") self.columnconfigure(0, pad=5) self.columnconfigure(1, pad=5, weight = 1) self.columnconfigure(2, pad=5) self.rowconfigure(0, pad=5, weight = 1) self.rowconfigure(1, pad=5, weight = 1) self.rowconfigure(2, pad=5, weight = 1) self.rowconfigure(3, pad=5, weight = 1) self.rowconfigure(4, pad=5, weight = 1) self.rowconfigure(5, pad=5, weight = 1) self.lInput = Label(self, text = "Input file") self.lInput.grid(row = 0, column = 0, sticky = W) self.lPRS = Label(self, text = "phospoRS Column Name") self.lPRS.grid(row = 1, column = 0, sticky = W) self.lScore = Label(self, text = "Min phosphoRS Score") self.lScore.grid(row = 2, column = 0, sticky = W) self.lDA = Label(self, text = "Check deamidation sites") self.lDA.grid(row = 3, column = 0, sticky = W) self.lLabFile = Label(self, text = "Label description file") self.lLabFile.grid(row = 4, column = 0, sticky = W) self.ifPathText = StringVar() self.prsScoreText = StringVar(value = '0') self.prsNameText = StringVar() self.doDAVar = IntVar() self.labFileText = StringVar(value = path.abspath('moddict.txt')) self.ifPath = Entry(self, textvariable = self.ifPathText) self.ifPath.grid(row = 0, column = 1, sticky = W+E) self.prsName = Entry(self, textvariable = self.prsNameText) self.prsName.grid(row = 1, column = 1, sticky = W+E) self.prsScore = Entry(self, textvariable = self.prsScoreText, state = DISABLED) self.prsScore.grid(row = 2, column = 1, sticky = W+E) self.doDABox = Checkbutton(self, variable = self.doDAVar) self.doDABox.grid(row = 3, column = 1, sticky = W) self.labFile = Entry(self, textvariable = self.labFileText) self.labFile.grid(row = 4, column = 1, sticky = W+E) self.foButton = Button(self, text = "Select file", command = self.selectFileOpen) self.foButton.grid(row = 0, column = 2, sticky = E+W, padx = 3) self.prsButton = Button(self, text = "Select column", state = DISABLED, command = self.selectColumn) self.prsButton.grid(row = 1, column = 2, sticky = E+W, padx = 3) self.labFileButton = Button(self, text = "Select file", command = self.selectLabFileOpen) self.labFileButton.grid(row = 4, column = 2, sticky = E+W, padx = 3) self.startButton = Button(self, text = "Start", command = self.start, padx = 3, pady = 3) self.startButton.grid(row = 5, column = 1, sticky = E+W) self.pack(fill = BOTH, expand = True, padx = 5, pady = 5)
def add_buttons(fr): but_fr = Frame(fr) if using_ttk or using_tile: ent[0] = Entry(but_fr, width=80) else: ent[0] = Entry(but_fr, width=80, highlightthickness=3, background=word_bg_color, highlightcolor=highlight_color) ent[0].pack(padx=5, pady=2) Button(but_fr, text='Clear Display', command=lambda : clear_all()) \ .pack(pady=2) but_fr.pack()
def body(self, master): Label(master, text="Label:").grid(row=0, sticky=W) Label(master, text="Theta (deg):").grid(row=1, sticky=W) self._label_var = StringVar(master, value=NodeInfoDialog._label_var) self._theta_var = StringVar(master, value=NodeInfoDialog._theta_var) self.e1 = Entry(master, textvariable=self._label_var) self.e2 = Entry(master, textvariable=self._theta_var) self.e1.grid(row=0, column=1) self.e2.grid(row=1, column=1) return self.e1 # initial focus
def initUI(self): self.parent.title("simple") self.i0 = IntVar() self.nvt = IntVar() self.R = IntVar() Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10') self.columnconfigure(0, pad=3) self.columnconfigure(3, pad=3) self.rowconfigure(0, pad=3) self.rowconfigure(4, pad=3) # i0 self.entryi0 = Entry(self) self.entryi0.grid(row=0, column=1, sticky=W + E) cb = Checkbutton(self, text="i0", variable=self.i0) cb.select() cb.grid(row=1, column=1) cblabel = Label(self, text="use Value?") cblabel.grid(row=2, column=1) # nvt self.entrynvt = Entry(self) self.entrynvt.grid(row=0, column=2, sticky=W + E) cb = Checkbutton(self, text="nVt", variable=self.nvt) cb.select() cb.grid(row=1, column=2) cblabel = Label(self, text="use Value?") cblabel.grid(row=2, column=2) # R self.entryR = Entry(self) self.entryR.grid(row=0, column=3, sticky=W + E) cb = Checkbutton(self, text="R", variable=self.R) cb.select() cb.grid(row=1, column=3) cblabel = Label(self, text="use Value?") cblabel.grid(row=2, column=3) quitbutton = Button(self, text="quit", command=self.parent.destroy) quitbutton.grid(row=8, column=0) refreshbutton = Button(self, text="refresh", command=self.onClick) refreshbutton.grid(row=8, column=4) self.pack()
def __init__(self, name, add_handler, remove_handler, master=None): """ Creates a ListFrame with the given name as its title. add_handler and remove_handler are functions to be called when items are added or removed, and should relay the information back to the Searcher (or whatever object actually uses the list). """ LabelFrame.__init__(self, master) self['text'] = name self.add_handler = add_handler self.remove_handler = remove_handler self.list = Listbox(self) self.list.grid(row=0, columnspan=2) # Tkinter does not automatically close the right-click menu for us, # so we must close it when the user clicks away from the menu. self.list.bind("<Button-1>", lambda event: self.context_menu.unpost()) self.list.bind("<Button-3>", self.open_menu) self.context_menu = Menu(self, tearoff=0) self.context_menu.add_command(label="Remove", command=self.remove) self.input = Entry(self) self.input.bind("<Return>", lambda event: self.add()) self.input.grid(row=1, columnspan=2) self.add_button = Button(self) self.add_button['text'] = "Add" self.add_button['command'] = self.add self.add_button.grid(row=2, column=0, sticky=W + E) self.remove_button = Button(self) self.remove_button['text'] = "Remove" self.remove_button['command'] = self.remove self.remove_button.grid(row=2, column=1, sticky=W + E)
def __init__(self, root): super().__init__() self.root = root self.exception = None self.list_string = StringVar() self.listbox = Listbox(root, listvariable=self.list_string, font='TkFixedFont', width=30) self.write_cache = '' self.logfile = None self.enable_logging = BooleanVar() self.enable_logging_checkbox = Checkbutton( root, var=self.enable_logging, text='Enable logging', command=self.enable_logging_changed) self.logfile_label = Label(root, text='Logfile name:') self.logfile_name = StringVar() self.logfile_name_entry = Entry(root, textvar=self.logfile_name) self.load()
def initUI(self): # This should be different if running on Windows.... content = pyperclip.paste() print content self.entries_found = [] self.parent.title("Add a new command card") self.style = Style() self.style.theme_use("default") self.pack() self.new_title_label = Label(self, text="Title") self.new_title_label.grid(row=0, columnspan=2) self.new_title_entry = Entry(self, width=90) self.new_title_entry.grid(row=1, column=0) self.new_title_entry.focus() self.new_content_label = Label(self, text="Card") self.new_content_label.grid(row=2, columnspan=2) self.new_content_text = Text(self, width=110, height=34) self.new_content_text.insert(END, content) self.new_content_text.grid(row=3, columnspan=2) self.add_new_btn = Button(self, text="Add New Card", command=self.onAddNew) self.add_new_btn.grid(row=4)
def initUI(self): config = ConfigParser.ConfigParser() config.read('settings.ini') default_sheet = config.get('USER', 'default_spreadsheet') self.pack(fill=BOTH, expand=True) self.columnconfigure(1, weight=1) self.columnconfigure(3, pad=7) self.rowconfigure(3, weight=1) self.rowconfigure(5, pad=7) self.lblTsv = Label(self, text="Enter TSV Export:") self.lblTsv.grid(sticky=W, pady=4, padx=5) self.txtTsv = Text(self) self.txtTsv.grid(row=1, column=0, columnspan=2, rowspan=4, padx=5, sticky=E+W+N+S) self.btnSubmit = Button(self, text="Submit", command=self.submit_text) self.btnSubmit.grid(row=6, column=4, padx=5) self.btnUpload = Button(self, text="Upload to GS", command = self.upload_db) self.btnUpload.grid(row=6, column=3, padx=5) self.btnCancel = Button(self, command=sys.exit, text="Quit") self.btnCancel.grid(row=6, column=2, padx=5) self.lblSheet = Label(self, text="Enter google sheets URL:") self.lblSheet.grid(row=5, sticky=W, pady=4, padx=4) self.sheetUrl = Entry(self) self.sheetUrl.grid(row=6, columnspan=2, sticky=W+E, padx=5, pady=5) self.sheetUrl.insert(0, default_sheet) return
def buildValueWidget(frame, optType): if optType == "FOO": pass else: var = StringVar() widget = Entry(frame, textvariable=var) return widget, var
def initUI(self): self.entries_found = [] self.parent.title("Search your command cards") self.style = Style() self.style.theme_use("default") self.pack() self.input_title = Label(self, text="Enter your command below") self.input_title.grid(row=0, columnspan=2) self.input_box = Entry(self, width=90) self.input_box.grid(row=1, column=0) self.input_box.focus() self.input_box.bind("<Key>", self.onUpdateSearch) self.search_btn = Button(self, text="Search", command=self.onSearch) self.search_btn.grid(row=1, column=1) self.output_box = Treeview(self, columns=("Example")) ysb = Scrollbar(self, orient='vertical', command=self.output_box.yview) xsb = Scrollbar(self, orient='horizontal', command=self.output_box.xview) self.output_box.configure(yscroll=ysb.set, xscroll=xsb.set) self.output_box.heading('Example', text='Example', anchor='w') self.output_box.column("#0", minwidth=0, width=0, stretch=NO) self.output_box.column("Example", minwidth=0, width=785) self.output_box.bind("<Button-1>", self.OnEntryClick) self.output_box.grid(row=3, columnspan=2) self.selected_box = Text(self, width=110, height=19) self.selected_box.grid(row=4, columnspan=2) self.gotoadd_btn = Button(self, text="Go to Add", command=self.onGoToAdd) self.gotoadd_btn.grid(row=5)
def initUI(self): self.parent.title("simple") Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10') self.columnconfigure(0, pad=3) self.columnconfigure(1, pad=3) self.columnconfigure(2, pad=3) self.columnconfigure(3, pad=3) self.rowconfigure(0, pad=3) self.rowconfigure(1, pad=3) self.rowconfigure(2, pad=3) self.rowconfigure(3, pad=3) self.rowconfigure(4, pad=3) entry = Entry(self) entry.grid(row=0, columnspan=4, sticky=W + E) ## cls = Button(self, text="Cls") ## cls.grid(row=1, column=0) label = Label(self, text="hello world") label.pack() frame = Frame(self) frame.pack(fill=BOTH, expand=1) quitbutton = Button(self, text="quit", command=self.parent.destroy) quitbutton.pack(side=RIGHT) self.pack(fill=BOTH, expand=.1)
def initUI(self): self.parent.title("simple") Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10') self.columnconfigure(0, pad=3) self.columnconfigure(3, pad=3) self.rowconfigure(0, pad=3) self.rowconfigure(4, pad=3) entry = Entry(self) entry.grid(row=0, columnspan=4, sticky=W + E) cls = Button(self, text="Cls") cls.grid(row=1, column=0) quitbutton = Button(self, text="quit", command=self.parent.destroy) quitbutton.grid(row=4, column=0) self.var = IntVar() cb = Checkbutton(self, text="show title", variable=self.var, command=self.onClick) cb.select() cb.grid(row=2, column=2) self.pack()
def _add_filename(self, frame, index, name, mode, option): if option: self.function[-1] = lambda v: [option, v] else: self.function[-1] = lambda v: [v] self.variables[-1] = StringVar() var = self.variables[-1] def set_name(): if mode == "r": fn = tkFileDialog.askopenfilename(initialdir=".") else: fn = tkFileDialog.asksaveasfilename(initialdir=".") var.set(fn) label = Label(frame, text=name) label.grid(row=index, column=0, sticky="W", padx=10) field_button = Frame(frame) Grid.columnconfigure(field_button, 0, weight=1) field = Entry(field_button, textvariable=var) field.grid(row=0, column=0, sticky="WE") button = Button(field_button, text="...", command=set_name, width=1, padding=0) button.grid(row=0, column=1) field_button.grid(row=index, column=1, sticky="WE")
def general_component(self, s, r, c, init_val='', help_txt=''): '''adds a label, plus an entry and its associated variable''' Label(self, text=s).grid(row=r, column=c, sticky=W) var = StringVar() var.set(init_val) Entry(self, textvariable=var).grid(row=r, column=c + 1) Label(self, text=help_txt).grid(row=r, column=c + 2) return var
def initUI(self): self.parent.title("Add Food") self.style = Style() self.style.theme_use("default") self.grid() l_name = Label(self.parent, text="Name") l_day = Label(self.parent, text="Day") l_month = Label(self.parent, text="Month") l_year = Label(self.parent, text="Year") l_name.grid(row=0, column=3) l_day.grid(row=0, column=0) l_month.grid(row=0, column=1) l_year.grid(row=0, column=2) days = [] months = [] years = [] days.extend(range(1, 32)) months.extend(range(1, 13)) years.extend(range(2015, 2036)) days = map(str, days) months = map(str, months) years = map(str, years) self.var_day = StringVar(self.parent) self.var_month = StringVar(self.parent) self.var_year = StringVar(self.parent) self.var_name = StringVar(self.parent) self.var_day.set(days[0]) self.var_month.set(months[0]) self.var_year.set(years[0]) f_name = Entry(self.parent, textvariable=self.var_name) f_day = apply(OptionMenu, (self.parent, self.var_day) + tuple(days)) f_month = apply(OptionMenu, (self.parent, self.var_month) +\ tuple(months)) f_year = apply(OptionMenu, (self.parent, self.var_year) +\ tuple(years)) f_name.grid(row=1, column=3) f_day.grid(row=1, column=0) f_month.grid(row=1, column=1) f_year.grid(row=1, column=2) add_btn = Button(self.parent, text="Add Food", command=self.add_food) add_btn.grid(row=0, column=5) cancel_btn = Button(self.parent, text="Cancel",\ command=self.cancel_food) cancel_btn.grid(row=1, column=5)
def _add_field(self, frame, index, name): self.variables[-1] = StringVar() label = Label(frame, text=name) label.grid(row=index, column=0, sticky="W", padx=10) field = Entry(frame) field.grid(row=index, column=1, sticky="WE", textvariable=self.variables[-1])
def add_file_browser(self, f, button_txt, init_txt, r, c, help_txt=''): b = Button(f, text=button_txt) b.grid(row=r, column=c, sticky=W + E) f_var = StringVar() f_var.set(init_txt) e = Entry(f, textvariable=f_var) e.grid(row=r, column=c + 1) b.configure(command=lambda: self.browse_file(f_var, b)) return f_var
def createWidgets(self): self.mainFrame = Frame(self.parent) Label(self.mainFrame, text = 'Tic Tac Toe', font = ("", 50)).pack() frame1 = Frame(self.mainFrame) Label(frame1, text = 'Player 1 (X, button - 1)').grid() Entry(frame1, textvariable = self.player1) Label(frame1, text = 'Player2 (O, button - 2)').grid() frame1.pack() self.mainFrame.pack(padx = 10, pady = 10)
def initUI(self): self.parent.title("Test the Gauss point") self.pack(fill=BOTH, expand=True) self.fields = \ 'bulk_modulus', \ 'scale_hardening', \ 'max_stress_in', \ 'increment_strain', \ 'Nloop', \ 'initial_confinement', \ 'reference_pressure', \ 'modulus_n', \ 'cohesion', \ 'RMC_shape_k', \ 'dilation_angle_eta', \ 'diletion_scale' default_values = \ '1E7', \ '1E3', \ '3E4', \ '1E-4', \ '2', \ '1E5', \ '1E5', \ '0.7', \ '0.0', \ '1.0', \ '1.0', \ '1.0' # ================== # Entries for User input: self.entries = [] for idx, field in enumerate(self.fields): row = Frame(self) row.pack(fill=X) labl = Label(row, text=field, width=30) labl.pack(side=LEFT, padx=5, pady=5) entry = Entry(row) entry.insert(END, default_values[idx]) entry.pack(fill=X, padx=5, expand=True) self.entries.append((field, entry)) # print field # ================== # Button for calculation frameButtonCalc = Frame(self) frameButtonCalc.pack(fill=X) calcButton = Button(frameButtonCalc, text="calculate", command=self.calculate) calcButton.pack(side=LEFT, padx=5, pady=5) # ================== # Raw Frame for plot self.canvasFrame = Frame(self) self.canvasFrame.pack(fill=BOTH, expand=True)
def initUI(self): self.parent.title("Catalog Analyzer") Style().configure("TButton", padding=(0, 5, 0, 5), font='serif 10') self.columnconfigure(0, pad=3) self.columnconfigure(1, pad=3) self.columnconfigure(2, pad=3) self.columnconfigure(3, pad=3) self.rowconfigure(0, pad=3) self.rowconfigure(1, pad=3) ## ENTRY ### band1Label = Label(self, text='Band 1') band1Label.grid(row=0, column=0) band1Entry = Entry(self) band1Entry.grid(row=0, column=1) band2Label = Label(self, text='Band 2') band2Label.grid(row=0, column=2) band2Entry = Entry(self) band2Entry.grid(row=0, column=3 ) band3Label = Label(self, text='Band 3') band3Label.grid(row=1, column=0) band3Entry = Entry(self) band3Entry.grid(row=1, column=1) band4Label = Label(self, text='Band 4') band4Label.grid(row=1, column=2) band4Entry = Entry(self) band4Entry.grid(row=1, column=3 ) ## BUTTONS ### sizeMagButton = Button(self, text ="Size Magnitude", command = sizeMag) sizeMagButton.grid(row=2 , column = 0) hrButton = Button(self, text ="H-R Diagram", command = HR) hrButton.grid(row=2 , column = 1) colorColorButton = Button(self, text='Color Color', command=colorColor) colorColorButton.grid(row=2 , column = 2) self.pack()
def __init__(self, parent, controller): tk.Frame.__init__(self, parent) self.controller = controller label = tk.Label(self, text=self._title, font=TITLE_FONT) label.pack(side="top", fill="x", pady=10) frame_apn = tk.Frame(self) frame_apn.pack(fill=tk.X) lbl_apn = tk.Label(frame_apn, text="apn", width=8) lbl_apn.pack(side=tk.LEFT, padx=5, pady=5) self.entry_apn = Entry(frame_apn) self.entry_apn.insert(tk.END, 'internet') self.entry_apn.pack(fill=tk.X, padx=5, expand=True) frame_username = tk.Frame(self) frame_username.pack(fill=tk.X) lbl_username = tk.Label(frame_username, text="username", width=8) lbl_username.pack(side=tk.LEFT, padx=5, pady=5) self.entry_username = Entry(frame_username) self.entry_username.pack(fill=tk.X, padx=5, expand=True) frame_password = tk.Frame(self) frame_password.pack(fill=tk.X) lbl_password = tk.Label(frame_password, text="password", width=8) lbl_password.pack(side=tk.LEFT, padx=5, pady=5) self.entry_password = Entry(frame_password) self.entry_password.pack(fill=tk.X, padx=5, expand=True) frame_dial_number = tk.Frame(self) frame_dial_number.pack(fill=tk.X) lbl_dial_number = tk.Label(frame_dial_number, text="dial_number", width=8) lbl_dial_number.pack(side=tk.LEFT, padx=5, pady=5) self.entry_dial_number = Entry(frame_dial_number) self.entry_dial_number.insert(tk.END, '*99#') self.entry_dial_number.pack(fill=tk.X, padx=5, expand=True) btn_exit = tk.Button(self, text="Back", command=self.OnClose) btn_exit.pack(side=tk.RIGHT, padx=5, pady=5) self.btn_test = tk.Button(self, text="Run", command=self.GPS3GTest) self.btn_test.pack(side=tk.RIGHT, padx=5, pady=5)
def initUI(self): self.parent.title("Driver Control Panel") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) self.label = Label(self, text="Bus Tracker - Driver", font=('Helvetica', '21')) self.label.grid(row=0, column=0) self.l = Label(self, text="Bus Line", font=('Helvetica', '18')) self.l.grid(row=1, column=0) self.e = Entry(self, font=('Helvetica', '18')) self.e.grid(row=2, column=0) self.l = Label(self, text="Direction", font=('Helvetica', '18')) self.l.grid(row=3, column=0) # add vertical space self.l = Label(self, text="", font=('Helvetica', '14')) self.l.grid(row=5, column=0) self.e = Entry(self, font=('Helvetica', '18')) self.e.grid(row=4, column=0) self.search = Button(self, text="Start") self.search.grid(row=6, column=0) ######### used for debug ########## # add vertical space self.l2 = Label(self, text="", font=('Helvetica', '14')) self.l2.grid(row=5, column=0) self.turnOnBtn = Button(self, text="Turn On") self.turnOnBtn["command"] = self.turnOn self.turnOnBtn.grid(row=6, column=0) self.startBtn = Button(self, text="Start") self.startBtn["command"] = self.start self.startBtn.grid(row=7, column=0) self.turnOffBtn = Button(self, text="Turn Off") self.turnOffBtn["command"] = self.turnOff self.turnOffBtn.grid(row=8, column=0)
def init_ui(self): self.parent_.title('Rough surface generator') self.pack(fill=BOTH, expand=True) # top panel with controls frame_top = Frame(self, background=self.TOP_FRAME_BACKGROUND_COLOR) frame_top.pack(fill=X) self.cb = Combobox(frame_top, values=('Gaussian', 'Laplace')) self.cb.current(0) self.cb.pack(side=LEFT, padx=5, expand=True) l1 = Label(frame_top, text=r'Cx', background=self.TOP_FRAME_BACKGROUND_COLOR, width=4) l1.pack(side=LEFT, padx=5, expand=True) self.entry1 = Entry(frame_top, validate='key', validatecommand=(self.register(self.on_validate), '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W'), width=10) self.entry1.pack(side=LEFT, padx=5, expand=True) self.entry1.insert(0, str(self.a_)) l1 = Label(frame_top, text=r'Cy', width=4, background=self.TOP_FRAME_BACKGROUND_COLOR) l1.pack(side=LEFT, padx=5) self.entry2 = Entry(frame_top, validate='key', validatecommand=(self.register(self.on_validate), '%d', '%i', '%P', '%s', '%S', '%v', '%V', '%W'), width=10) self.entry2.pack(side=LEFT, padx=5, expand=True) self.entry2.insert(0, str(self.b_)) but1 = Button(frame_top, text='RUN', command=self.button_action) but1.pack(side=RIGHT, padx=5, pady=5) # central panel. It will have a label with an image. Image may have a random noise state, or # transformed image state self.img_frame.pack(fill=BOTH, expand=True) img_label = Label(self.img_frame, background=None) img_label.pack(expand=True, fill=BOTH, padx=5, pady=5)
def label_1to1_int_entry(self, name="", default_int=-1, width=10): self.vb_name.append(name.split()[0]) self.all_comp.append(Label(self.master, text=name)) #self.all_comp[-1].pack(anchor='w') self.all_comp[-1].grid(row=self.row, sticky=E) # self.get_comp.append(IntVar(self.master, default_int)) self.all_comp.append( Entry(self.master, width=width, textvariable=self.get_comp[-1])) #self.all_comp[-1].pack() self.all_comp[-1].grid(row=self.row, column=1, sticky=W) # self.row += 1 #
def __init__(self): self.root = Tk() self.root.title(u'用户登录') self.root.resizable(False, False) self.root.geometry('+500+500') self.lb_user = Label(self.root, text=u'用户名:', padx=5) self.lb_passwd = Label(self.root, text=u'密码:', padx=5) self.lb_stime = Label(self.root, text=u'日期: ', padx=5) self.lb_sexmp = Label(self.root, text=u' (输入格式01,02,03)', padx=5) self.lb_mytext = Label(self.root, text=u'原因: ', padx=5) self.lb_user.grid(row=0, column=0, sticky=W) self.lb_passwd.grid(row=1, column=0, sticky=W) self.lb_stime.grid(row=2, column=0, sticky=W) self.lb_sexmp.grid(row=3, column=0, sticky=W) self.lb_mytext.grid(row=4, column=0, sticky=W) self.en_user = Entry(self.root, width=20) self.en_passwd = Entry(self.root, width=20) self.en_stime = Entry(self.root, width=20) self.en_reson = Entry(self.root, width=20) self.en_user.grid(row=0, column=1, columnspan=1) self.en_passwd.grid(row=1, column=1, columnspan=1) self.en_stime.grid(row=2, column=1, columnspan=1) self.en_reson.grid(row=4, column=1, columnspan=1, rowspan=3) self.var = IntVar() self.ckb = Checkbutton(self.root, text=u'记住用户名和密码', underline=0, variable=self.var) self.ckb.grid(row=9, column=0) self.bt_print = Button(self.root, text=u'确定', width=20) self.bt_print.grid(row=9, column=1, sticky=E, pady=5) self.bt_print.config(command=self.print_info) self.checkconf() self.root.mainloop() def validate_func(self, en): return False if eval(en).get().strip() != '' else True
def initUI(self): # creating gui self.frame1 = Frame(self) self.frame2 = Frame(self) self.frame3 = Frame(self) self.frame4 = Frame(self) self.frame5 = Frame(self) # created multiple frames self.label1 = Label(self.frame1, text="COURSE PROGRAM ESTIMATOR", font='Helvetica 25 bold', background="SpringGreen3", foreground="black") self.label2 = Label(self.frame1, text=" Training Data: ", font="Times 14") self.entry = Entry(self.frame1, width=65) self.entry.insert( 0, 'https://www.sehir.edu.tr/tr/duyurular/2017-2018-Akademik-Yili-Ders-Programi' ) self.color = Label( self.frame1, text=" ", background="red", ) self.button = Button(self.frame1, text="Fetch and Train", command=self.fetch) self.label3 = Label(self.frame2, text="Individual Courses:", font='Helvetica 10 bold') self.label4 = Label(self.frame3, text=" Top 3 Estimates:", font='Helvetica 10 bold') self.coursesListbox = Listbox(self.frame2, width=30) self.label5 = Label(self.frame4, text=" Accuracy Analysis \nBased on Programs: ", font='Helvetica 10 bold') self.programsListbox = Listbox(self.frame4, width=30) self.estimatesListbox = Text(self.frame5, width=30, height=10) self.scrollbar1 = Scrollbar(self.frame2, orient=VERTICAL) self.scrollbar2 = Scrollbar(self.frame4, orient=VERTICAL) self.scrollbar3 = Scrollbar(self.frame5, orient=VERTICAL) self.scrollbar1.config(command=self.coursesListbox.yview) self.scrollbar2.config(comman=self.programsListbox.yview) self.scrollbar3.config(command=self.estimatesListbox.yview) self.coursesListbox.config(yscrollcommand=self.scrollbar1.set) self.programsListbox.config(yscrollcommand=self.scrollbar2.set) self.estimatesListbox.config(yscrollcommand=self.scrollbar3.set)