def __init__(self, parent): self.parent = parent self.parent.title('MPU6050 - Acceleration and Gyroscope') self.frame = Frame(self.parent) self.frame.pack(fill=BOTH, expand=1) self.parent.resizable(width=False, height=False) self.plot_trigger = True self.record_trigger = False self.var_all = IntVar() self.var_plot = IntVar() self.var_rec = IntVar() self.accgyro_chkbtn_state = [] self.chkbtn_list = [] # Call MPU6050 class self.mpu = mpu6050(0x68) # LabelFrame - Select components self.labelframe_comp = LabelFrame(self.frame, text='Select components') self.labelframe_comp.grid(row=0, column=0, columnspan=3, sticky=N + E + W + S) self.labelframe_comp.grid_configure(padx=5, pady=5) # LabelFrame - Options to plot and record self.labelframe_opt = LabelFrame(self.frame, text='Options - Plot and Record') self.labelframe_opt.grid(row=0, column=3, columnspan=3, sticky=N + E + W + S) self.labelframe_opt.grid_configure(padx=5, pady=5) # Checkbuttons - Acceleration for i, j in enumerate(['Acc_x', 'Acc_y', 'Acc_z']): self.var_acc = IntVar() self.acc_chkbtn = Checkbutton(self.labelframe_comp, text=j, variable=self.var_acc, command=self.components_chk_func, padx=5, pady=5) self.acc_chkbtn.grid(row=i, column=0) self.accgyro_chkbtn_state.append(self.var_acc) self.chkbtn_list.append(self.acc_chkbtn) # Checkbuttons - Gyroscope for i, j in enumerate(['Gyro_x', 'Gyro_y', 'Gyro_z']): self.var_gyro = IntVar() self.gyro_chkbtn = Checkbutton(self.labelframe_comp, text=j, variable=self.var_gyro, command=self.components_chk_func, padx=5, pady=5) self.gyro_chkbtn.grid(row=i, column=1) self.accgyro_chkbtn_state.append(self.var_gyro) self.chkbtn_list.append(self.gyro_chkbtn) # Checkbutton - All self.all_chkbtn = Checkbutton(self.labelframe_comp, text='All', variable=self.var_all, command=self.all_chk_func, padx=5, pady=5) self.all_chkbtn.grid(row=1, column=2) # Button - Record to a file self.rec_chkbtn = ttk.Button( self.labelframe_opt, text='Start Recording', command=lambda: self.record_start_stop('rec_btn')) self.rec_chkbtn.grid(row=1, column=0, sticky=N + E + W + S, padx=5, pady=10) self.rec_chkbtn.configure(state='disabled') # Label - File name self.rec_text = Label(self.labelframe_opt, text='to file (.csv)') self.rec_text.grid(row=1, column=1, sticky=N + E + W + S) # Entry - File name (Default name: SensorDataFile) self.file_name = ttk.Entry(self.labelframe_opt) self.file_name.insert(0, 'SensorDataFile') self.file_name.grid(row=1, column=2, sticky=N + E + W + S, padx=5, pady=10) self.file_name.configure(state='disabled')
def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#ececec' # Closest X11 color: 'gray92' font11 = "-family {Segoe UI} -size 30 -weight bold -slant " \ "roman -underline 0 -overstrike 0" self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background=[('selected', _compcolor), ('active', _ana2color)]) top.geometry("500x280+428+169") top.title("Naive Bayes Classifer") top.configure(background="#3e5d93") self.title_naiveBayes = tk.Label(top) self.title_naiveBayes.place(relx=0.08, rely=0.0, height=60, width=416) self.title_naiveBayes.configure(activebackground="#f0f0f0") self.title_naiveBayes.configure(activeforeground="white") self.title_naiveBayes.configure(background="#3e5d93") self.title_naiveBayes.configure(disabledforeground="#a3a3a3") self.title_naiveBayes.configure(font=font11) self.title_naiveBayes.configure(foreground="white") self.title_naiveBayes.configure(text='''Naive Bayes Classifier''') self.directory_frame = tk.LabelFrame(top) self.directory_frame.place(relx=0.06, rely=0.214, relheight=0.232, relwidth=0.88) self.directory_frame.configure(relief='groove') self.directory_frame.configure(foreground="white") self.directory_frame.configure(text='''Directory Path''') self.directory_frame.configure(background="#3e5d93") self.directory_frame.configure(width=440) self.Browse_button = ttk.Button(top) self.Browse_button.place(relx=0.71, rely=0.304, height=25, width=96) self.Browse_button.configure(takefocus="") self.Browse_button.configure(text='''Browse''') self.Browse_button.configure(width=96) self.Browse_button.configure(cursor="fleur") self.Browse_button.configure(command=self.folderBrowseAction) self.directory_textField = ttk.Entry(top) self.directory_textField.place(relx=0.08, rely=0.304, relheight=0.075, relwidth=0.592) self.directory_textField.configure(width=296) self.directory_textField.configure(takefocus="") self.directory_textField.configure(cursor="ibeam") self.directory_textField.bind("<FocusOut>", self.valuesCheckButtonAbillity) self.Build_button = ttk.Button(top) self.Build_button.place(relx=0.61, rely=0.5, height=55, width=166) self.Build_button.configure(takefocus="") self.Build_button.configure(text='''Build''') self.Build_button.configure(width=166) self.Build_button.configure(state='disable') self.Build_button.configure(command=self.startBuild) self.Dicritezation_frame = tk.LabelFrame(top) self.Dicritezation_frame.place(relx=0.06, rely=0.5, relheight=0.232, relwidth=0.32) self.Dicritezation_frame.configure(relief='groove') self.Dicritezation_frame.configure(foreground="white") self.Dicritezation_frame.configure(text='''Discretization Bins''') self.Dicritezation_frame.configure(background="#3e5d93") self.Dicritezation_frame.configure(width=160) self.bins_textField = ttk.Entry(top) self.bins_textField.place(relx=0.08, rely=0.589, relheight=0.075, relwidth=0.252) self.bins_textField.configure(takefocus="") self.bins_textField.configure(cursor="ibeam") self.bins_textField.bind("<Key>", self.bindListenerVal) self.Classify_button = ttk.Button(top) self.Classify_button.place(relx=0.61, rely=0.714, height=55, width=166) self.Classify_button.configure(takefocus="") self.Classify_button.configure(text='''Classify''') self.Classify_button.configure(width=166) self.Classify_button.configure(command=self.startClassify) self.Classify_button.configure(state='disable') self.inputBindAlret = ttk.Label(top) self.inputBindAlret.place(relx=0.05, rely=0.75, height=35, width=202) self.inputBindAlret.configure(background="#3e5d93") self.inputBindAlret.configure(foreground="#3e5d93") self.inputBindAlret.configure(relief='flat') self.inputBindAlret.configure( text= '''The bins number is not valid!\nplease enter only positive number''' ) self.inputBindAlret.configure(width=202) self.bindValOk = False self.directoryValOk = False self.menubar = tk.Menu(top, font="TkMenuFont", bg=_bgcolor, fg=_fgcolor) top.configure(menu=self.menubar)
tkMessageBox.showinfo( "Info", "The server will run in the background. \n If you need to reopen it for some reason, open it from the Start menu." ) else: pass app.destroy() return menu = Menu(app) app.config(menu=menu) helpmenu = Menu(menu) menu.add_cascade(label="Help", menu=helpmenu) helpmenu.add_command(label="About...", command=about) started = StringVar() infolbl = ttk.Label(app, text="IP Address:") iplbl = ttk.Label(app, text=ip.get_lan_ip()) infolbl3 = ttk.Label(app, textvariable=started) infolbl2 = ttk.Label(app, text="Port:") port = ttk.Entry(app) start = ttk.Button(app, text="Start Server", command=uivalid) infolbl.grid(column=1, row=0, padx=3) infolbl2.grid(column=1, row=1) infolbl3.grid(column=1, row=2, padx=3, pady=3) iplbl.grid(column=2, row=0) port.grid(column=2, row=1) start.grid(column=4, row=1, padx=5, pady=5) app.protocol('WM_DELETE_WINDOW', hide) app.mainloop()
def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' top.withdraw() time_start = time.time() splash = sup.SplashWindow(top) self.style = ttk.Style() if sys.platform == 'win32': self.style.theme_use('winnative') self.style.configure('.', font='TkDefaultFont') #~ top.geometry('838x455+364+117') top.geometry('850x440') top.title('MSTM studio') #~ top.configure(highlightcolor='black') self.load_images() self.root_panedwin = ttk.Panedwindow(top, orient='horizontal') self.root_panedwin.place(relx=0.0, rely=0.0, relheight=1.0, relwidth=1.0) self.root_panedwin.configure(width=200) self.left_frame = ttk.Frame(width=220.0) self.root_panedwin.add(self.left_frame) #~ self.middle_frame = ttk.Labelframe(width=350, text='View') self.middle_frame = ttk.Frame(width=350) self.root_panedwin.add(self.middle_frame) self.right_frame = ttk.Frame() self.root_panedwin.add(self.right_frame) self.__funcid0 = self.root_panedwin.bind('<Map>', self.__adjust_sash0) self.left_panedwin = ttk.Panedwindow(self.left_frame, orient='vertical') self.left_panedwin.place(relx=0.0, rely=0.0, relheight=1.0, relwidth=1.0) self.left_panedwin.configure(width=200) self.materials_frame = ttk.Labelframe(height=105, text='Materials') self.left_panedwin.add(self.materials_frame) self.spheres_frame = ttk.Labelframe(text='Spheres') self.left_panedwin.add(self.spheres_frame) self.__funcid1 = self.left_panedwin.bind('<Map>', self.__adjust_sash1) self.style.configure('Treeview.Heading', font='TkDefaultFont') self.stvMaterial = ScrolledTreeView(self.materials_frame) self.stvMaterial.place(relx=0.0, y=30, relheight=0.8, relwidth=1.0) self.configure_stvMaterial() self.stvMaterial.bind('<Double-1>', sup.btChangeMatColClick) self.btAddMat = ttk.Button(self.materials_frame, command=sup.btAddMatClick, text='A', image=self.imAdd) self.btAddMat.place(x=5, y=0, height=25, width=25) self.btLoadMat = ttk.Button(self.materials_frame, command=sup.btLoadMatClick, text='L', image=self.imLoad) self.btLoadMat.place(x=30, y=0, height=25, width=25) self.btPlotMat = ttk.Button(self.materials_frame, command=sup.btPlotMatClick, text='P', image=self.imPlot) self.btPlotMat.place(x=55, y=0, height=25, width=25) self.btDelMat = ttk.Button(self.materials_frame, command=sup.btDelMatClick, text='D', image=self.imDelete) self.btDelMat.place(relx=1, x=-30, rely=0, height=25, width=25) self.stvSpheres = ScrolledTreeView(self.spheres_frame) self.stvSpheres.place(relx=0.0, y=30, relheight=0.85, relwidth=1.0) self.configure_stvSpheres() self.stvSpheres.bind('<Double-1>', sup.btEditSphClick) self.btAddSph = ttk.Button(self.spheres_frame, command=sup.btAddSphClick, text='A', image=self.imAdd) self.btAddSph.place(x=5, y=0, height=25, width=25) self.btEditSph = ttk.Button(self.spheres_frame, command=sup.btEditSphClick, text='E', image=self.imEdit) self.btEditSph.place(x=30, y=0, height=25, width=25) self.btPlotSph = ttk.Button(self.spheres_frame, command=sup.btPlotSphClick, text='R', image=self.imRefresh) self.btPlotSph.place(x=55, y=0, height=25, width=25) self.lbEnvMat = ttk.Label(self.spheres_frame, text='Matrix') self.lbEnvMat.place(relx=0.45, y=-5) self.cbEnvMat = ttk.Combobox(self.spheres_frame) self.cbEnvMat.place(relx=0.45, y=10, width=55) self.btDelSph = ttk.Button(self.spheres_frame, command=sup.btDelSphClick, text='D', image=self.imDelete) self.btDelSph.place(relx=1.0, y=0, x=-30, height=25, width=25) self.middle_panedwin = ttk.Panedwindow(self.middle_frame, orient='vertical') self.middle_panedwin.place(relx=0.0, rely=0.0, relheight=1.0, relwidth=1.0) #~ self.middle_panedwin.configure(relwidth=1.0) self.canvas_frame = ttk.Labelframe(height=360, text='View') self.middle_panedwin.add(self.canvas_frame) self.spectrum_frame = ttk.Labelframe(height=-40, text='MSTM') self.middle_panedwin.add(self.spectrum_frame) self.__funcid2 = self.left_panedwin.bind('<Map>', self.__adjust_sash2) self.canvas = Canvas(self.canvas_frame) self.canvas.place(relx=0.0, rely=0, relheight=1.0, relwidth=1.0) self.canvas.configure(background='white') self.canvas.configure(borderwidth='2') self.canvas.configure(relief='ridge') self.canvas.configure(selectbackground='#c4c4c4') self.canvas.bind('<Button-4>', sup.mouse_wheel) # for Linux self.canvas.bind('<Button-5>', sup.mouse_wheel) # for Linux self.canvas.bind('<MouseWheel>', sup.mouse_wheel) # for Windowz self.canvas.bind('<Button-3>', sup.mouse_down) self.canvas.bind('<B3-Motion>', sup.mouse_move) self.canvas.bind('<ButtonRelease-3>', sup.mouse_up) self.lbZoom = ttk.Label( self.canvas, text='x1.00', background='white') #font=('courier', 18, 'bold'), width=10) self.lbZoom.place(relx=1.0, x=-50, rely=1.0, y=-25) self.btSetupSpec = ttk.Button(self.spectrum_frame, command=sup.btSetupSpecClick, text='Setup...', image=self.imSetup, compound='left') self.btSetupSpec.place(x=10, y=10, width=90, height=25) self.btCalcSpec = ttk.Button(self.spectrum_frame, command=sup.btCalcSpecClick, text='Calculate', image=self.imCalc, compound='left') self.btCalcSpec.place(x=130, y=10, width=90, height=25) self.lbSpecScale = ttk.Label(self.spectrum_frame, text='scale') self.lbSpecScale.place(relx=1, x=-115, y=0) self.edSpecScale = ttk.Entry(self.spectrum_frame) self.edSpecScale.place(relx=1, x=-115, y=15, width=50) self.edSpecScale.insert(0, '1') self.btSaveSpec = ttk.Button(self.spectrum_frame, command=sup.btSaveSpecClick, text='S', image=self.imSave) self.btSaveSpec.place(relx=1, x=-55, y=10, width=25, height=25) self.btPlotSpec = ttk.Button(self.spectrum_frame, command=sup.btPlotSpecClick, text='P', image=self.imPlot) self.btPlotSpec.place(relx=1, x=-30, y=10, width=25, height=25) self.right_panedwin = ttk.Panedwindow(self.right_frame, orient='vertical') self.right_panedwin.place(relx=0.0, rely=0.0, relheight=1.0, relwidth=1.0) self.right_panedwin.configure(width=200) self.plot_frame = ttk.Labelframe(height=200, text='Plot') self.right_panedwin.add(self.plot_frame) self.contribs_frame = ttk.Labelframe(height=150, text='Other contributions') self.right_panedwin.add(self.contribs_frame) self.fitting_frame = ttk.Labelframe(height=-50, text='Fitting') self.right_panedwin.add(self.fitting_frame) self.__funcid3 = self.right_panedwin.bind('<Map>', self.__adjust_sash3) # CONTRIBUTIONS self.btAddContrib = ttk.Button(self.contribs_frame, command=sup.btAddContribClick, text='A', image=self.imAdd) self.btAddContrib.place(x=5, y=0, height=25, width=25) self.btPlotAllContribs = ttk.Button(self.contribs_frame, command=sup.btPlotAllContribsClick, text='P', image=self.imPlot) self.btPlotAllContribs.place(x=30, y=0, height=25, width=25) self.btDelContrib = ttk.Button(self.contribs_frame, command=sup.btDelContribClick, text='D', image=self.imDelete) self.btDelContrib.place(relx=1.0, y=0, x=-30, height=25, width=25) self.cbContribs = [] self.edContribs = [] # actually, it will be the list of lists [[]] self.btPlotsContrib = [] self.contribs_list = [ 'ConstBkg', 'LinearBkg', 'LorentzBkg', 'Mie single', 'Mie LN', 'Spheroid', 'Lorentz peak', 'Gauss peak' ] # 'Au film', 'bst-3Au/glass'] self.cbContribMats = [] self.btContribDistribPlots = [] # Fitting frame self.edExpFileName = ttk.Entry(self.fitting_frame, text='Exp. file name') self.edExpFileName.place(x=5, y=0, height=25, relwidth=0.8) self.btLoadExp = ttk.Button(self.fitting_frame, command=sup.btLoadExpClick, text='L', image=self.imLoad) self.btLoadExp.place(relx=1.0, x=-55, y=0, height=25, width=25) self.btPlotExp = ttk.Button(self.fitting_frame, command=sup.btPlotExpClick, text='P', image=self.imPlot) self.btPlotExp.place(relx=1.0, x=-30, y=0, height=25, width=25) self.btStartFit = ttk.Button(self.fitting_frame, command=sup.btStartFitClick, text='>', image=self.imPlay) self.btStartFit.place(x=5, y=30, height=25, width=25) self.btStopFit = ttk.Button(self.fitting_frame, command=sup.btStopFitClick, text='|', image=self.imStop) self.btStopFit.place(x=30, y=30, height=25, width=25) self.lbChiSq = ttk.Label(self.fitting_frame, text='ChiSq:') self.lbChiSq.place(x=60, y=35) self.btConstraints = ttk.Button(self.fitting_frame, command=sup.btConstraintsClick, text='Constraints...') self.btConstraints.place(relx=1, x=-100, y=30, height=25, width=95) self._create_menu(top) time_delta = time.time() - time_start # in seconds if time_delta < self.splash_time: time.sleep(self.splash_time - time_delta) top.deiconify() splash.destroy()
def __init__(self, master): master.title("PyFinder") self.master_width = 800 self.master_height = 400 self.master_padding_x = master.winfo_screenwidth() // 2 - self.master_width // 2 self.master_padding_y = master.winfo_screenheight() // 2 - self.master_height // 2 master.resizable(False, False) master.geometry('{}x{}+{}+{}'.format(self.master_width, self.master_height, self.master_padding_x, self.master_padding_y)) self.frame_welcome = ttk.Frame(master) self.frame_welcome.pack() ttk.Label(self.frame_welcome, text="Welcome to the PyFinder! Search through a Python modules content", font=('Corbel', 10, 'bold'), justify=CENTER).pack(pady=5) self.frame_settings = ttk.Frame(master, height=120, width=800) self.frame_settings.pack() self.frame_settings.pack_propagate(0) self.frame_settings_left = ttk.Frame(self.frame_settings) self.frame_settings_left.pack(side=LEFT) self.frame_settings_right = ttk.Frame(self.frame_settings) self.frame_settings_right.pack(side=LEFT) ttk.Label(self.frame_settings_left, text='Set directory:', font=('Corbel', 10, 'bold')).grid(row=0, column=0, padx=5, sticky='sw') ttk.Label(self.frame_settings_left, text='Search for:',font=('Corbel', 10, 'bold')).grid(row=3, column=0, padx=5, sticky='sw') self.entry_dir = ttk.Entry(self.frame_settings_left, width=34) self.entry_dir.grid(row=1, column=0, padx=5, sticky='sw') self.is_dir_label = ttk.Label(self.frame_settings_left, text="No such directory", font=('Corbel', 8)) self.is_dir_label.grid(row=2, column=0, columnspan=2, padx=5, sticky='se') self.entry_term = ttk.Entry(self.frame_settings_left, width=40) self.entry_term.grid(row=4, column=0, columnspan=2, padx=5, sticky='sw') self.is_term_label = ttk.Label(self.frame_settings_left, text="Invalid input", font=('Corbel', 8)) self.is_term_label.grid(row=5, column=0, columnspan=2, padx=5, sticky='se') self.dir_button = ttk.Button(self.frame_settings_left, width=4, text='...') self.dir_button.grid(row=1, column=1, sticky='sw') self.modules_button = ttk.Button(self.frame_settings_left, width=12, text='Add path ->') self.modules_button.grid(row=1, column=2, padx=17, sticky='sw') self.search_button = ttk.Button(self.frame_settings_left, width=12, text='Search!') self.search_button.grid(row=4, column=2, padx=17, sticky='sw') ttk.Label(self.frame_settings_right, text="Found Py modules:", font=('Corbel', 10, 'bold')).grid(row=0, padx=6, column=0, sticky='sw') self.dir_checkbox = ttk.Checkbutton(self.frame_settings_right, text="Show root directory") self.dir_checkbox.grid(row=0, column=1, padx=6, sticky='se') self.modules_box = Listbox(self.frame_settings_right, width=68) self.modules_box.grid(row=1, column=0, columnspan=2, padx=6, sticky='sw') self.frame_progress = ttk.Frame(master) self.frame_progress.pack() self.progress_bar = ttk.Progressbar(self.frame_progress, orient=HORIZONTAL, length=700) self.progress_bar.grid(row=0, column=0, pady=10, padx=5) self.cancel_button = ttk.Button(self.frame_progress, text='Cancel') self.cancel_button.grid(row=0, column=1, pady=10, padx=6, sticky='se') self.frame_results = ttk.Frame(master) self.frame_results.pack() self.frame_results_left = ttk.Frame(self.frame_results) self.frame_results_left.pack(side=LEFT) self.frame_results_right = ttk.Frame(self.frame_results) self.frame_results_right.pack(side=LEFT) ttk.Label(self.frame_results_left, text='Display:', font=('Corbel', 10, 'bold')).pack(padx=5, pady=5, anchor='sw') self.func_button = ttk.Radiobutton(self.frame_results_left, text="Functions") self.func_button.pack(pady=5, padx=5, anchor='sw') self.class_button = ttk.Radiobutton(self.frame_results_left, text="Classes") self.class_button.pack(pady=5, padx=5, anchor='sw') self.text_button = ttk.Radiobutton(self.frame_results_left, text="Other apperance") self.text_button.pack(pady=5, padx=5, anchor='sw') self.frame_author = ttk.Frame(master) self.frame_author.pack() ttk.Label(self.frame_author, text="Created by Mariusz Hager, November 2017 [email protected]", font=('Corbol', 6), justify=CENTER).pack(pady=5)
def __init__(self, top=None): autocompleteList = [] '''conn = pymssql.connect(server="10.10.1.XXX", user="******", password="******", database="NXXa", timeout=0, login_timeout=60, charset='UTF-8', as_dict=False, host='', appname=None, port='22507', conn_properties=None, autocommit=False, tds_version=None) cursor = conn.cursor() cursor.execute("select u2.id,u2.userName,u2.mailAddress,ou2.organizationUnitName,fd.functionDefinitionName from "+ "OrganizationUnit as ou2 "+ "join Functions as f2 with (nolock) on f2.organizationUnitOID=ou2.OID and f2.isMain=1 "+ "join Users as u2 with (nolock) on u2.OID=f2.occupantOID "+ "join FunctionDefinition as fd on fd.OID=f2.definitionOID "+ "where ou2.organizationOID='1c5b85fcc42410048f6cef01866cc71b' order by id") row = cursor.fetchall()''' workbookN = xlrd.open_workbook( r'\\10.10.1.36\ManagementApproach\UserData.xlsx') sheet1N = workbookN.sheet_by_index(0) nrows = sheet1N.nrows ncols = sheet1N.ncols for i in range(0, nrows): #for j in range(0,ncols): autocompleteList.append( sheet1N.cell(i, 0).value + '_' + sheet1N.cell(i, 1).value) #for values in row: # autocompleteList.append(values[0]+'_'+values[1]) _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#d9d9d9' # X11 color: 'gray85' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background=[('selected', _compcolor), ('active', _ana2color)]) top.geometry("700x338+526+233") top.title("味全公司") top.configure(background="#d9d9d9") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") self.Label1 = tk.Label(top) self.Label1.place(relx=0.414, rely=0.03, height=38, width=132) self.Label1.configure(activebackground="#f9f9f9") self.Label1.configure(activeforeground="black") self.Label1.configure(background="#d9d9d9") self.Label1.configure(disabledforeground="#a3a3a3") self.Label1.configure(foreground="#000000") self.Label1.configure(highlightbackground="#d9d9d9") self.Label1.configure(highlightcolor="black") self.Label1.configure(text='''員工分機查詢''') self.Label2 = tk.Label(top) self.Label2.place(relx=0.057, rely=0.237, height=18, width=52) self.Label2.configure(activebackground="#f9f9f9") self.Label2.configure(activeforeground="black") self.Label2.configure(background="#d9d9d9") self.Label2.configure(disabledforeground="#a3a3a3") self.Label2.configure(foreground="#000000") self.Label2.configure(highlightbackground="#d9d9d9") self.Label2.configure(highlightcolor="black") self.Label2.configure(text='''姓名:''') self.Label3 = tk.Label(top) self.Label3.place(relx=0.414, rely=0.237, height=18, width=42) self.Label3.configure(activebackground="#f9f9f9") self.Label3.configure(activeforeground="black") self.Label3.configure(background="#d9d9d9") self.Label3.configure(disabledforeground="#a3a3a3") self.Label3.configure(foreground="#000000") self.Label3.configure(highlightbackground="#d9d9d9") self.Label3.configure(highlightcolor="black") self.Label3.configure(text='''部門:''') self.Entry2 = tk.Entry(top) self.Entry2.place(relx=0.486, rely=0.237, height=17, relwidth=0.477) self.Entry2.configure(background="#d9d9d9") self.Entry2.configure(disabledforeground="#a3a3a3") self.Entry2.configure(font="TkFixedFont") self.Entry2.configure(foreground="#000000") self.Entry2.configure(highlightbackground="#d9d9d9") self.Entry2.configure(highlightcolor="black") self.Entry2.configure(insertbackground="black") self.Entry2.configure(selectbackground="#c4c4c4") self.Entry2.configure(selectforeground="black") self.Entry2.configure(width=334) self.Label4 = tk.Label(top) self.Label4.place(relx=0.4, rely=0.296, height=38, width=62) self.Label4.configure(activebackground="#f9f9f9") self.Label4.configure(activeforeground="black") self.Label4.configure(background="#d9d9d9") self.Label4.configure(disabledforeground="#a3a3a3") self.Label4.configure(foreground="#000000") self.Label4.configure(highlightbackground="#d9d9d9") self.Label4.configure(highlightcolor="black") self.Label4.configure(text='''員編:''') self.Label4.configure(width=62) self.Entry3 = tk.Entry(top) self.Entry3.place(relx=0.486, rely=0.325, height=17, relwidth=0.206) self.Entry3.configure(background="#d9d9d9") self.Entry3.configure(disabledforeground="#a3a3a3") self.Entry3.configure(font="TkFixedFont") self.Entry3.configure(foreground="#000000") self.Entry3.configure(highlightbackground="#d9d9d9") self.Entry3.configure(highlightcolor="black") self.Entry3.configure(insertbackground="black") self.Entry3.configure(selectbackground="#c4c4c4") self.Entry3.configure(selectforeground="black") self.TProgressbar1 = ttk.Progressbar(top) self.TProgressbar1.place(relx=0.057, rely=0.473, relwidth=0.914, relheight=0.0, height=17) self.TProgressbar1.configure(length="640") #self.TButton1 = ttk.Button(top,command=self.QueryUser) #self.TButton1.place(relx=0.298, rely=0.154, height=23, width=77) #self.TButton1.configure(takefocus="") #self.TButton1.configure(text='''查詢''') self.Label5 = tk.Label(top) self.Label5.place(relx=0.057, rely=0.621, height=18, width=52) self.Label5.configure(activebackground="#f9f9f9") self.Label5.configure(activeforeground="black") self.Label5.configure(background="#d9d9d9") self.Label5.configure(disabledforeground="#a3a3a3") self.Label5.configure(foreground="#000000") self.Label5.configure(highlightbackground="#d9d9d9") self.Label5.configure(highlightcolor="black") self.Label5.configure(text='''分機:''') self.Entry4 = tk.Entry(top) self.Entry4.place(relx=0.143, rely=0.621, height=17, relwidth=0.206) self.Entry4.configure(background="#d9d9d9") self.Entry4.configure(disabledforeground="#a3a3a3") self.Entry4.configure(font="TkFixedFont") self.Entry4.configure(foreground="#000000") self.Entry4.configure(highlightbackground="#d9d9d9") self.Entry4.configure(highlightcolor="black") self.Entry4.configure(insertbackground="black") self.Entry4.configure(selectbackground="#c4c4c4") self.Entry4.configure(selectforeground="black") self.Label6 = tk.Label(top) self.Label6.place(relx=0.414, rely=0.621, height=18, width=52) self.Label6.configure(activebackground="#f9f9f9") self.Label6.configure(activeforeground="black") self.Label6.configure(background="#d9d9d9") self.Label6.configure(disabledforeground="#a3a3a3") self.Label6.configure(foreground="#000000") self.Label6.configure(highlightbackground="#d9d9d9") self.Label6.configure(highlightcolor="black") self.Label6.configure(text='''信箱:''') self.Entry5 = tk.Entry(top) self.Entry5.place(relx=0.486, rely=0.621, height=17, relwidth=0.334) self.Entry5.configure(background="#d9d9d9") self.Entry5.configure(disabledforeground="#a3a3a3") self.Entry5.configure(font="TkFixedFont") self.Entry5.configure(foreground="#000000") self.Entry5.configure(highlightbackground="#d9d9d9") self.Entry5.configure(highlightcolor="black") self.Entry5.configure(insertbackground="black") self.Entry5.configure(selectbackground="#c4c4c4") self.Entry5.configure(selectforeground="black") self.Label7 = tk.Label(top) self.Label7.place(relx=0.057, rely=0.74, height=18, width=52) self.Label7.configure(activebackground="#f9f9f9") self.Label7.configure(activeforeground="black") self.Label7.configure(background="#d9d9d9") self.Label7.configure(disabledforeground="#a3a3a3") self.Label7.configure(foreground="#000000") self.Label7.configure(highlightbackground="#d9d9d9") self.Label7.configure(highlightcolor="black") self.Label7.configure(text='''位置:''') self.Label8 = tk.Label(top) self.Label8.place(relx=0.7, rely=0.325, height=18, width=42) self.Label8.configure(activebackground="#f9f9f9") self.Label8.configure(activeforeground="black") self.Label8.configure(background="#d9d9d9") self.Label8.configure(disabledforeground="#a3a3a3") self.Label8.configure(foreground="#000000") self.Label8.configure(highlightbackground="#d9d9d9") self.Label8.configure(highlightcolor="black") self.Label8.configure(text='''職稱:''') self.Entry6 = tk.Entry(top) self.Entry6.place(relx=0.757, rely=0.325, height=17, relwidth=0.206) self.Entry6.configure(background="#d9d9d9") self.Entry6.configure(disabledforeground="#a3a3a3") self.Entry6.configure(font="TkFixedFont") self.Entry6.configure(foreground="#000000") self.Entry6.configure(highlightbackground="#d9d9d9") self.Entry6.configure(highlightcolor="black") self.Entry6.configure(insertbackground="black") self.Entry6.configure(selectbackground="#c4c4c4") self.Entry6.configure(selectforeground="black") self.Entry1 = tk.Entry(top) # self.entry1 = tk.Entry(top) self.Entry1.place(relx=0.129, rely=0.237, height=17, relwidth=0.206) self.Entry1.configure(background="white") self.Entry1.configure(disabledforeground="#a3a3a3") self.Entry1.configure(font="TkFixedFont") self.Entry1.configure(foreground="#000000") self.Entry1.configure(insertbackground="black") # self.Label9 = tk.Label(top) # self.Label9.place(relx=0.011, rely=0.01, height=50, width=50) #self.Label8.configure(background="#d9d9d9") #photo = tk.PhotoImage(file='LOGO.png') #self.Label9.configure(image=photo) #self.Label9.image =photo # self.Label9.configure(background="#d9d9d9") # self.Label9.configure(disabledforeground="#a3a3a3") #self.Label9.configure(foreground="#000000") # self.Label9.configure(text='''Image''') self.Button1 = tk.Button(top, command=self.OpenFile) self.Button1.place(relx=0.143, rely=0.828, height=19, width=81) self.Button1.configure(activebackground="#d9d9d9") self.Button1.configure(activeforeground="#000000") self.Button1.configure(background="#d9d9d9") self.Button1.configure(disabledforeground="#a3a3a3") self.Button1.configure(foreground="#000000") self.Button1.configure(highlightbackground="#d9d9d9") self.Button1.configure(highlightcolor="black") self.Button1.configure(pady="0") self.Button1.configure(text='''開啟座位表''') self.Button1.configure(width=81) self.Entry7 = tk.Entry(top) self.Entry7.place(relx=0.143, rely=0.74, height=17, relwidth=0.677) self.Entry7.configure(background="#d9d9d9") self.Entry7.configure(disabledforeground="#a3a3a3") self.Entry7.configure(font="TkFixedFont") self.Entry7.configure(foreground="#000000") self.Entry7.configure(insertbackground="black") self.Entry7.configure(width=474) self.val1 = tk.StringVar(root, value='') self.val1.trace( 'w', autocomplate(autocompleteList, self.Entry1, self.Entry3, self.Entry2, self.Entry6, self.Entry5, self.Entry4, self.Entry7)) self.entry1 = tk.Entry(textvariable=self.val1) self.entry1.place(relx=0.129, rely=0.296, relheight=0.001, relwidth=0.01) self.entry1.configure(background="#d9d9d9") self.entry1.configure(disabledforeground="#a3a3a3") self.entry1.configure(font="TkFixedFont") self.entry1.configure(foreground="#000000") self.entry1.configure(width=144) self.addrow = ttk.Button(top, text="Test", width=12, command=self.addrow)
def __init__(self, master, can, originX, originY, instrumentDict, beatDict, lineX, lineY, instrument): self.can = can self.iDict = instrumentDict self.bDict = beatDict self.oX = originX self.oY = originY self.lineX = lineX self.lineY = lineY self.i = instrument self.labelSubs = StringVar() self.labelSubs.set(str(16)) self.arr = [] self.WIDTH = 600 self.HEIGHT = 200 Toplevel.__init__(self) self.mainFrame = ttk.Frame(self) self.mainFrame.grid() self.upperFrame = ttk.Frame(self.mainFrame) self.upperFrame.grid(row=0, column=0) ##### FILLER ARRAYS self.timeCan = TimeCanvas(self.upperFrame, self.i.arr, self.i.arrG, self.i.arrP, width=self.WIDTH, height=self.HEIGHT) self.timeCan.grid(row=0, column=0) self.PMFrame = ttk.Frame(self.upperFrame) self.PMFrame.grid(row=0, column=1, sticky=N) 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.delButton = ttk.Button(self.PMFrame, text="Delete", command=self.delete) self.delButton.grid(row=3, column=0, sticky=S) self.envelope = ENV(self.PMFrame, self.i.env) self.envelope.grid(row=4) self.lowerFrame = ttk.Frame(self.mainFrame) self.lowerFrame.grid(row=1, column=0, sticky=W) self.tName = ttk.Entry(self.lowerFrame, width=10) self.tName.grid(row=0, column=0) self.tName.insert(0, self.i.n) self.tSource = ttk.Entry(self.lowerFrame) self.tSource.grid(row=0, column=1) source = "track_source" if self.iDict.get(self.i.n): source = self.iDict[self.i.n].instrument.source self.tSource.insert(0, source) self.boxVal = StringVar() self.lBox = ttk.Combobox(self.lowerFrame, textvariable=self.boxVal, width=10) self.lBox['values'] = ("sample", "beat", "osc") #self.lBox.current("osc") self.lBox.grid(row=0, column=2) self.goButton = ttk.Button(self.lowerFrame, text="Make", command=self.make) self.goButton.grid(row=0, column=3) self.bind("e", self.edit)
random.shuffle(n) b = random.choice(n) random.shuffle(nu) c = random.choice(nu) random.shuffle(alp) d = a + b + c + random.choice(alp) + random.choice(alp) entry2.delete(0, END) entry2.insert(0, d) label2 = ttk.Label(root, text='Key : ') label2.grid(row=0, column=0) entry2 = ttk.Entry(root, width=40) entry2.grid(row=0, column=1, columnspan=4) MyButton6 = ttk.Button(root, text='genarate', width=10, command=gen) MyButton6.grid(row=2, column=4) # ------------------- X ---------------- # WebSearch from box class Memo: a = [ 'Big', 'Cute', 'Red', 'Blue', 'Black', 'Back', 'Old', 'Dark', 'Small', 'Captain', 'Large', 'Nice', 'Good', 'Lovely', 'Handsome', 'White', 'Hero', 'Striker' ] n = [ 'Apple', 'Ball', 'Bot', 'Bat', 'Chicken', 'Dog', 'Diamond', 'Disco'
def gui(): def About(): tkMessageBox.showinfo( "About", "Quicklook Parser v.3\nMari DeGrazia\[email protected]") def Help(): tkMessageBox.showinfo( "Help", 'This will parse the index.sqlite and thumbnails.data files from com.apple.QuickLook.thumbnailcache folder.\n\nSelect the com.apple.QuickLook.thumbnailcache folder, or a folder containing these files\n\nSelect an empty output folder. A report will be generated with the metadata for the thumbnails,and a subfolder named "thumbnails" will be created containg the thumbnail images.' ) def clear_textbox(): ttk.e1.delete(0, END) ttk.e2.delete(0, END) def openfolder(): folder1 = askdirectory() ttk.e1.insert(10, folder1) #check to see if it is a valid database file error = verify_files(folder1) if error is not True: tkMessageBox.showinfo("Error", error) ttk.e1.insert(10, "") return False def savefolder(): folder2 = askdirectory() ttk.e2.insert(10, folder2) def process(): master.config(cursor="watch") master.update() openfolder = ttk.e1.get() savefolder = ttk.e2.get() thisReportType = ReportType.get() if thisReportType == 1: out_format = "tab" else: out_format = "excel" stats = process_database(openfolder, savefolder, out_format) if stats[0] == "Error": tkMessageBox.showinfo("Error", stats[1]) master.config(cursor="") master.update() return () master.config(cursor="") master.update() tkMessageBox.showinfo( "Processing Complete", "Records in table: " + str(stats[0]) + "\n" + "Thumbnails available: " + str(stats[1]) + "\nThumbnails extracted: " + str(stats[2])) if sys.platform == "win32": os.startfile(savefolder) master = Tk() master.wm_title("Quicklook Parser") script_path = os.path.dirname(sys.argv[0]) icon_file = os.path.join("resources", "qlook.ico") icon = os.path.join(script_path, icon_file) #only set icon for windows if 'nt' == os.name: if os.path.exists(icon): master.iconbitmap(icon) menu = Menu(master) master.config(menu=menu) helpmenu = Menu(menu) menu.add_cascade(label="Help", menu=helpmenu) helpmenu.add_command(label="About...", command=About) helpmenu.add_command(label="Instructions...", command=Help) #ttk.Label(master,justify=LEFT,text="Open QuickLook thumbnailcache folder:").grid(row=6,column=0,sticky=W) ttk.Button(text='Open thumbnailcache folder...', command=openfolder, width=30).grid(row=7, column=0, sticky=W) ttk.e1 = Entry(master, width=50) ttk.e1.grid(row=7, column=1, sticky=E) ttk.Button(text='Save Report and Thumbnails...', command=savefolder, width=30).grid(row=8, column=0, sticky=W) ttk.e2 = Entry(master, width=50) ttk.e2.grid(row=8, column=1, sticky=E) ReportType = IntVar() ReportType.set(1) tsv_button = Radiobutton(master, text="TSV", variable=ReportType, value=1).grid(row=1, column=0, sticky=W) if xlsxwriter_installed is True: excel_button = Radiobutton(master, text="Excel", variable=ReportType, value=2).grid(row=2, column=0, sticky=W) else: excel_button = Radiobutton(master, text="Excel(Install xlsxwriter library)", variable=ReportType, value=2, state=DISABLED).grid(row=2, column=0, sticky=W) ttk.Button(text='Process', command=process, width=30).grid(row=11, column=0, sticky=W) ttk.Button(text='Clear', command=clear_textbox, width=30).grid(row=12, column=0, sticky=W) mainloop()
variant_entry.grid(column=1, row=2, sticky=(W, E)) sample_entry.grid(column=2, row=2, sticky=(W, E)) gene_entry.grid(column=3, row=2, sticky=(W, E)) transcript_entry.grid(column=4, row=2, sticky=(W, E)) variant_lab = ttk.Label(queryframe, text="Variant") variant_lab.grid(column=1, row=1, sticky=W) sample_lab = ttk.Label(queryframe, text="Sample") sample_lab.grid(column=2, row=1, sticky=W) gene_lab = ttk.Label(queryframe, text="Gene") gene_lab.grid(column=3, row=1, sticky=W) transcript_lab = ttk.Label(queryframe, text="Refseq Transcript") transcript_lab.grid(column=4, row=1, sticky=W) select_but = ttk.Button(queryframe, text="Search", command=frequency_query) select_but.grid(column=5, row=2) """ Login frame for application """ loginframe = ttk.Frame(root) loginframe.grid(column=1, row=1, columnspan=2,rowspan=4) loginframe.columnconfigure(0, weight=1) loginframe.rowconfigure(0, weight=1) username = StringVar() password = StringVar() username_entry = ttk.Entry(loginframe, width=10, textvariable=username) # show="*" provides a mask for password entry password_entry = ttk.Entry(loginframe, show="*", width=10, textvariable=password)
def __init__(self, parent, *args, **kwargs): self.send_command = kwargs.pop('command', lambda *args, **kwargs: None) self.asset_text_var = kwargs.pop('assettextvariable', None) ttk.Frame.__init__(self, parent, *args, **kwargs) common_args = {} ## ## Upper Spacer: ## lblSpacerActiveTop = ttk.Label(self, text="", **common_args) lblSpacerActiveTop.pack(expand=True, fill="y") ## ## Destination Account: ## frameToWhom = ttk.Frame(self, **common_args) frameToWhom.pack(padx=10, pady=5, fill="x") self.to_account_name = ttk.Entry(frameToWhom) self.to_account_name.pack(side="right", padx=10) labelSendTo = ttk.Label(frameToWhom, text="Send To: (BitShares User Account)", font=("Helvetica", 16), **common_args) labelSendTo.pack(side="right") ## ## Amount and Asset: ## frameSendAmount = ttk.Frame(self, **common_args) frameSendAmount.pack(padx=10, pady=5, fill="x") self.box_asset_to_send = ttk.Entry(frameSendAmount, width=10, textvariable=self.asset_text_var) self.box_asset_to_send.pack(side="right", padx=10) labelAsset = ttk.Label(frameSendAmount, text="Asset:", font=("Helvetica", 16), **common_args) labelAsset.pack(padx=(20, 0), side="right") self.box_amount_to_send = ttk.Entry(frameSendAmount) self.box_amount_to_send.pack(side="right", padx=10) labelAmount = ttk.Label(frameSendAmount, text="Amount:", font=("Helvetica", 16), **common_args) labelAmount.pack(side="right") ## ## The Send Button: ## self.button_send = ttk.Button( self, text="Send Transfer", command=lambda: self.button_send_handler()) self.button_send.pack(pady=30) ## ## Lower Spacer: ## lblSpacerActiveBottom = ttk.Label(self, text="", **common_args) lblSpacerActiveBottom.pack(expand=True, fill="y")
def __init__(self, parent, controller): tk.Frame.__init__(self, parent) self.configure(bg=PADDING_COLOR, highlightcolor=PADDING_COLOR, highlightbackground=PADDING_COLOR) self.canvas = FigureCanvasTkAgg(f, self) self.canvas.get_tk_widget().grid(row=0, column=0, sticky='nsew', padx=5, pady=4, ipadx=0, ipady=0) self.canvas.get_tk_widget().configure( bg=BACKGROUND_COLOR, highlightcolor=PADDING_COLOR, highlightbackground=PADDING_COLOR, relief=tk.SUNKEN, bd=1) self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=1) frame2 = tk.Frame(self) frame2.grid(row=1, column=0, columnspan=1, sticky='WE', padx=7, pady=5) frame2.configure(bg=BACKGROUND_COLOR, highlightcolor=BACKGROUND_COLOR, highlightbackground=BACKGROUND_COLOR, relief=tk.SUNKEN, bd=1) # frame2.pack(side=tk.BOTTOM, fill=tk.BOTH, expand=1) frame3 = tk.Frame(self) frame3.grid(row=0, column=2, rowspan=2, sticky='NS', padx=3, pady=4) frame3.configure(bg=PADDING_COLOR, highlightcolor=PADDING_COLOR, highlightbackground=PADDING_COLOR) buttonsFrame = tk.Frame(self, relief=tk.SUNKEN, bd=1) buttonsFrame.configure(bg=BACKGROUND_COLOR, highlightcolor=BACKGROUND_COLOR, highlightbackground=BACKGROUND_COLOR) buttonsFrame.grid(row=0, column=1, rowspan=2, sticky='NS', pady=5.2, padx=2) button1 = ttk.Button(buttonsFrame, text="Force Release", cursor='hand2', command=lambda: SendPacket('r')) button1.grid(row=0, column=0, padx=2, pady=2, sticky='nsew') button2 = ttk.Button(buttonsFrame, text="Capture", cursor='hand2', command=lambda: SendPacket('c')) button2.grid(row=0, column=1, padx=0, pady=2, sticky='nsew') button3 = ttk.Button(buttonsFrame, text="Picture", cursor='hand2', command=lambda: controller.show_frame(StartPage)) button3.grid(row=1, column=0, padx=2, pady=0, sticky='nsew') button4 = ttk.Button( buttonsFrame, text="Send State", cursor='hand2', command=lambda: SendPacket(self.sendentry.get() + '\n')) button4.grid(row=1, column=1, padx=0, pady=0, sticky='nsew') sendlabel = tk.Label(buttonsFrame, text="Send State", font=SMALL_FONT) sendlabel.grid(row=2, column=0, columnspan=2, sticky='NS', padx=5, pady=5) sendlabel.configure(bg=BACKGROUND_COLOR, fg=TEXT_COLOR, highlightcolor=BACKGROUND_COLOR, highlightbackground=BACKGROUND_COLOR) self.sendentry = ttk.Entry(buttonsFrame, width=7) self.sendentry.grid(row=3, column=0, columnspan=2, sticky='NS', padx=5, pady=5) rangelabel = tk.Label(buttonsFrame, text="Plot Range", font=SMALL_FONT) rangelabel.grid(row=4, column=0, columnspan=2, sticky='NS', padx=5, pady=5) rangelabel.configure(bg=BACKGROUND_COLOR, fg=TEXT_COLOR, highlightcolor=BACKGROUND_COLOR, highlightbackground=BACKGROUND_COLOR) self.rangeentry1 = ttk.Entry(buttonsFrame, width=5) self.rangeentry1.grid(row=5, column=0, columnspan=2, sticky='NS', padx=5, pady=5) rangebutton = ttk.Button(buttonsFrame, text="Update Range", cursor='hand2', command=self.GetSetPlotRange) rangebutton.grid(row=6, column=0, columnspan=2, sticky='NS', padx=5, pady=5) # -------------------------------------------------------------------------------------------------------------- mfFrame = tk.Frame(buttonsFrame) mfFrame.grid(row=7, column=0, columnspan=2, sticky='nsew', padx=5, pady=5) mfFrame.configure(bg=BACKGROUND_COLOR, highlightcolor=BACKGROUND_COLOR, highlightbackground=BACKGROUND_COLOR) mfscrollbar = ttk.Scrollbar(mfFrame) mfscrollbar.grid(row=0, column=2, sticky='NS') self.marklistbox = tk.Listbox(mfFrame, selectmode=tk.SINGLE, yscrollcommand=mfscrollbar.set) self.marklistbox.grid(row=0, column=0, columnspan=2, sticky='nsew') mfscrollbar.config(command=self.marklistbox.yview) markerlist = [ 'point', 'pixel', 'circle', 'triangledown', 'triangleup', 'triangleleft', 'triangleright', 'octagon', 'square', 'pentagon', 'star', 'hexagon1', 'hexagon2', 'plus', 'X', 'diamond', 'thindiamond', 'vline', 'hline', 'None' ] for marker in markerlist: self.marklistbox.insert(tk.END, marker) mkbutton = ttk.Button(mfFrame, text='Set Marker', cursor='hand2', command=lambda: self.GetSetMarkerSymbol()) mkbutton.grid(row=1, column=1, columnspan=1, sticky='NS', padx=5, pady=5) self.mksize = tk.Entry(mfFrame, width=5) self.mksize.grid(row=1, column=0, padx=5, pady=5) toolbar = NavigationToolbar2TkAgg(self.canvas, frame2) toolbar.update() toolbar.configure(bg=BACKGROUND_COLOR, highlightcolor=BACKGROUND_COLOR, highlightbackground=BACKGROUND_COLOR, padx=1)
def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) self.Ran = False self.TimeCol = 0 self.dateindex = 0 self.configure(bg="white", highlightcolor="white", highlightbackground="white") self.wm_title("GCS (Version 1.0)") self.protocol('WM_DELETE_WINDOW', self.endprog) container = tk.Frame(self) container.pack(side="top", fill="both", expand=True) container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) frameCon = tk.Frame(self) #frameCon.grid(row=2, column=0, columnspan=2, sticky='WE', padx=7, pady=5) frameCon.pack(side='bottom', fill='both') frameCon.configure(bg=PADDING_COLOR, highlightcolor=PADDING_COLOR, highlightbackground=PADDING_COLOR, bd=1, padx=5, pady=5) textCon = tk.Text(frameCon) textCon.configure( height=12, bg=BACKGROUND_COLOR, fg="#FFFFFF", highlightcolor=BACKGROUND_COLOR, highlightbackground=BACKGROUND_COLOR, ) textCon.pack(side='left', fill='x', expand=True) buttonCon = ttk.Button(frameCon, command=self.pauseConsole) buttonCon.pack(side='right', fill='y', padx=2) buttonCon.configure(text="P", width=3) conSb = ttk.Scrollbar(frameCon) conSb.pack(side='right', fill='y') textCon.configure(yscrollcommand=conSb.set) conSb.configure(command=textCon.yview) oldstdout = sys.stdout sys.stdout = TermRedirect(textCon, oldstdout, "stdout") self.menubar = tk.Menu(container) filemenu = tk.Menu(self.menubar, tearoff=0) filemenu.add_radiobutton(label="Start Serial Comms", command=lambda: ControlSerial("start", self)) filemenu.add_radiobutton(label="Pause Serial Comms", command=lambda: self.popup1( "WARNING!", "Any " "incoming data " "will be lost!", "stop")) filemenu.add_radiobutton(label="End Serial Comms", command=lambda: self.popup1( "WARNING!", "Serial " "Communication " "Will be Terminated", "end")) filemenu.add_separator() filemenu.add_command(label="Exit", command=self.endprog) filemenu.configure(bg=BACKGROUND_MENU_COLOR, fg=TEXT_COLOR) self.menubar.add_cascade(label="File", menu=filemenu) # DisplayChoice #self.MainBackend(menubar) PlotControl = tk.Menu(self.menubar, tearoff=0) PlotControl.configure(bg=BACKGROUND_MENU_COLOR, fg=TEXT_COLOR) PlotControl.add_radiobutton(label="Resume Plot", command=lambda: LoadPlot('start')) PlotControl.add_radiobutton(label="Pause Plot", command=lambda: LoadPlot('pause')) self.menubar.add_cascade(label="Pause/Resume Plotting", menu=PlotControl) PortMenu = tk.Menu(self.menubar, tearoff=0) PortMenu.configure(bg=BACKGROUND_MENU_COLOR, fg=TEXT_COLOR) PortMenu.add_command( label="Enter Port", command=lambda: self.PopPortDia("Enter Port (COMX):")) self.menubar.add_cascade(label="Port", menu=PortMenu) tk.Tk.config(self, menu=self.menubar) self.frames = {} for F in (StartPage, PageThree): frame = F(container, self) self.frames[F] = frame frame.grid(row=0, column=0, sticky="nsew") self.show_frame(PageThree)
def init_user_interface(self): ''' Initializes the User Interface''' self.grid() self.heading = tkFont.Font(family='Roboto', size=12, weight='bold') self.body = tkFont.Font(family='Roboto', size=10) self.parent.title("Generic Audio Classifier") self.style = ttk.Style() self.style.theme_use('clam') self.grid(sticky=(Tkinter.N, Tkinter.W, Tkinter.E, Tkinter.S)) ttk.Label(self, text='Init', font=self.heading).grid(column=0, row=0) ttk.Button(self, text='Read Files', command=self.backend.run_db).grid(column=0, row=1) ttk.Label(self, text='Classes (subdirectories):', font=self.body).grid(column=0, row=2) ttk.Label(self, textvariable=self.backend.n_subdirs, font=self.heading).grid(column=0, row=3) ttk.Label(self, text='Files:', font=self.body).grid(column=0, row=4) ttk.Label(self, textvariable=self.backend.n_files, font=self.heading).grid(column=0, row=5) ttk.Separator(self, orient=Tkinter.HORIZONTAL).grid(column=0, row=6, sticky="ew") ttk.Label(self, text='Process', font=self.heading).grid(column=0, row=8) ttk.Label(self, text='Sample Rate:\n(Hz)', font=self.body).grid(column=0, row=9) Tkinter.Entry(self, textvariable=self.backend.sample_rate, width=12).grid(column=0, row=10) ttk.Button(self, text='Process Files', command=self.backend.process).grid(column=0, row=11) ttk.Progressbar(self, mode='determinate', orient=Tkinter.HORIZONTAL, variable=self.backend.process_progress).grid(column=0, row=12) ttk.Label(self, textvariable=self.backend.process_dur, font=self.body).grid(column=0, row=13) ttk.Label(self, text='Evaluation', font=self.heading).grid(column=1, row=0) ttk.Button(self, text='Evaluate Features', command=self.backend.evaluate).grid(column=1, row=1) ttk.Progressbar(self, mode='determinate', orient=Tkinter.HORIZONTAL, variable=self.backend.evaluation_progress).grid( column=1, row=2) ttk.Button(self, text='Run comparison', command=self.backend.run_eval).grid(column=1, row=3) ttk.Progressbar(self, mode='determinate', orient=Tkinter.HORIZONTAL, variable=self.backend.comparison_progress).grid( column=1, row=4) self.evaluation_results = Tkinter.Text(self, width=20, height=12) self.evaluation_results.grid(column=1, row=5, rowspan=7) results_scrollbar = Tkinter.Scrollbar( self, orient=Tkinter.VERTICAL, command=self.evaluation_results.yview) self.evaluation_results.config(yscrollcommand=results_scrollbar.set) results_scrollbar.grid(column=1, row=7, sticky=Tkinter.E) ttk.Label(self, text='Chosen Model', font=self.heading).grid(column=2, row=0) ttk.Label(self, text='Desired K:', font=self.body).grid(column=2, row=1, sticky=Tkinter.W) Tkinter.Entry(self, textvariable=self.backend.final_K, width=12).grid(column=2, row=2, sticky=Tkinter.E) self.backend.final_K.trace('w', self.backend.generate_model) ttk.Label(self, textvariable=self.backend.gen_progress).grid(column=2, row=3) ttk.Button(self, text='Save Model', command=self.model_save_prompt).grid(column=2, row=4) ttk.Label(self, text='Metrics', font=self.heading).grid(column=3, row=0) ttk.Button(self, text='Save\n Confusion Matrix', command=self.fig_save_prompt).grid(column=3, row=2) ttk.Button(self, text='Save Text Report', command=self.report_save_prompt).grid(column=3, row=1) ttk.Button(self, text='Quit', command=self.quit).grid(column=3, row=99) for child in self.winfo_children(): child.grid_configure(padx=10, pady=2) self.columnconfigure('all', minsize=140) self.columnconfigure(5, minsize=70)
def __init__(self, root): # Will hold the changing value stored in the entry self.entry_value = StringVar(root, value="") # Define title for the app root.title("Calculator") # Defines the width and height of the window root.geometry("530x285") # Block resizing of Window root.resizable(width=False, height=False) # Customize the styling for the buttons and entry style = ttk.Style() style.configure("TButton", font="Serif 15", padding=10) style.configure("TEntry", font="Serif 18", padding=10) # Create the text entry box self.number_entry = ttk.Entry(root, textvariable=self.entry_value, width=50) self.number_entry.grid(row=0, columnspan=4) # ----- 1st Row ----- self.button7 = ttk.Button(root, text="7", command=lambda: self.button_press('7')).grid( row=1, column=0) self.button8 = ttk.Button(root, text="8", command=lambda: self.button_press('8')).grid( row=1, column=1) self.button9 = ttk.Button(root, text="9", command=lambda: self.button_press('9')).grid( row=1, column=2) self.button_div = ttk.Button( root, text="/", command=lambda: self.math_button_press('/')).grid(row=1, column=3) # ----- 2nd Row ----- self.button4 = ttk.Button(root, text="4", command=lambda: self.button_press('4')).grid( row=2, column=0) self.button5 = ttk.Button(root, text="5", command=lambda: self.button_press('5')).grid( row=2, column=1) self.button6 = ttk.Button(root, text="6", command=lambda: self.button_press('6')).grid( row=2, column=2) self.button_mult = ttk.Button( root, text="*", command=lambda: self.math_button_press('*')).grid(row=2, column=3) # ----- 3rd Row ----- self.button1 = ttk.Button(root, text="1", command=lambda: self.button_press('1')).grid( row=3, column=0) self.button2 = ttk.Button(root, text="2", command=lambda: self.button_press('2')).grid( row=3, column=1) self.button3 = ttk.Button(root, text="3", command=lambda: self.button_press('3')).grid( row=3, column=2) self.button_add = ttk.Button( root, text="+", command=lambda: self.math_button_press('+')).grid(row=3, column=3) # ----- 4th Row ----- self.button_clear = ttk.Button(root, text="AC", command=self.clear_text).grid(row=4, column=0) self.button0 = ttk.Button(root, text="0", command=lambda: self.button_press('0')).grid( row=4, column=1) self.button_equal = ttk.Button( root, text="=", command=lambda: self.equal_button_press()).grid(row=4, column=2) self.button_sub = ttk.Button( root, text="-", command=lambda: self.math_button_press('-')).grid(row=4, column=3) self.prime_check = ttk.Button(root, text="Prime Check", command=lambda: do_prime()).grid( row=5, column=0) self.gcd = ttk.Button(root, text="GCD Check", command=lambda: gcdEntry()).grid(row=5, column=1) self.dotButton = ttk.Button( root, text=".", command=lambda: self.button_press('.')).grid(row=5, column=2)
def __init__(self, parent, controller): Tk.Frame.__init__(self, parent) use_gui = True self.__gt = gantry_control.GantryControl([0, 3100, 0, 1600], use_gui) oBelt = self.__gt.get_serial_x_handle() oSpindle = self.__gt.get_serial_y_handle() oShaft = self.__gt.get_serial_a_handle() # Notebook #notebook_label = ttk.Label(self, text="Control") #notebook_label.grid(row=3, column=2, pady=3) notebook_frame = ttk.Notebook(self) notebook_frame.grid(row=4, column=2, padx=30, pady=4) velcontrl_frame = ttk.Frame(notebook_frame) absposcontrl_frame = ttk.Frame(notebook_frame) relposcontrl_frame = ttk.Frame(notebook_frame) man_contrl_frame = ttk.Frame(notebook_frame) notebook_frame.add(velcontrl_frame, text="Velocity Control") notebook_frame.add(absposcontrl_frame, text="Abs Position Control") notebook_frame.add(relposcontrl_frame, text="Rel Position Control") notebook_frame.add(man_contrl_frame, text="Manual Control") label_pos_xy = ttk.Label(self, text='X = ?mm\nY = ?mm\nA = ?rad') label_pos_xy.grid(row=1, column=1) def get_position(): pos_x_mm, pos_y_mm, pos_a_rad = self.__gt.get_gantry_pos_xya_mmrad( ) label_pos_xy.configure(text='X = ' + str(int(pos_x_mm)) + 'mm \nY = ' + str(int(pos_y_mm)) + 'mm \nA = ' + str(round(float(pos_a_rad), 4)) + 'rad') return True button_gantry_position = ttk.Button(self, text='Update Position', command=lambda: get_position()) button_gantry_position.grid(row=1, column=0) """ Belt-Drive """ firstrow_belt = 2 label_spindle_name = ttk.Label(velcontrl_frame, text='Belt-drive', font=LARGE_FONT) label_spindle_name.grid(row=firstrow_belt + 0, column=1) button3 = ttk.Button(velcontrl_frame, text='v-- V [-]', command=lambda: oBelt.set_drive_speed(-1 * int( entry_v_belt.get()))) button3.grid(row=firstrow_belt + 1, column=0) button4 = ttk.Button(velcontrl_frame, text='STOP', command=lambda: oBelt.set_drive_speed(0)) button4.grid(row=firstrow_belt + 1, column=1) button5 = ttk.Button( velcontrl_frame, text='[+] V --^', command=lambda: oBelt.set_drive_speed(1 * int(entry_v_belt.get()))) button5.grid(row=firstrow_belt + 1, column=2) label_v_belt = ttk.Label(velcontrl_frame, text='Velocity:') entry_v_belt = ttk.Entry(velcontrl_frame) entry_v_belt.insert(0, '0') label_v_belt.grid(row=firstrow_belt + 2, column=0) entry_v_belt.grid(row=firstrow_belt + 2, column=1) """ Spindle-Drive """ firstrow_spindle = 5 label_spindle_name = ttk.Label(velcontrl_frame, text='Spindle-drive', font=LARGE_FONT) label_spindle_name.grid(row=firstrow_spindle + 0, column=1) button2 = ttk.Button(velcontrl_frame, text='<-- V [-]', command=lambda: oSpindle.set_drive_speed(-1 * int( entry_v_spindle.get()))) button2.grid(row=firstrow_spindle + 1, column=0) button3 = ttk.Button(velcontrl_frame, text='STOP', command=lambda: oSpindle.set_drive_speed(0)) button3.grid(row=firstrow_spindle + 1, column=1) button4 = ttk.Button(velcontrl_frame, text='[+] V -->', command=lambda: oSpindle.set_drive_speed(1 * int( entry_v_spindle.get()))) button4.grid(row=firstrow_spindle + 1, column=2) label_v_spindle = ttk.Label(velcontrl_frame, text='Velocity:') entry_v_spindle = ttk.Entry(velcontrl_frame) entry_v_spindle.insert(0, '0') label_v_spindle.grid(row=firstrow_spindle + 2, column=0) entry_v_spindle.grid(row=firstrow_spindle + 2, column=1) """ Shaft-Drive """ firstrow_shaft = 8 label_shaft_name = ttk.Label(velcontrl_frame, text='Shaft-drive', font=LARGE_FONT) label_shaft_name.grid(row=firstrow_shaft + 0, column=1) button2 = ttk.Button(velcontrl_frame, text='<-- V [-]', command=lambda: oShaft.set_drive_speed(-1 * int( entry_v_shaft.get()))) button2.grid(row=firstrow_shaft + 1, column=0) button3 = ttk.Button(velcontrl_frame, text='STOP', command=lambda: oShaft.set_drive_speed(0)) button3.grid(row=firstrow_shaft + 1, column=1) button4 = ttk.Button(velcontrl_frame, text='[+] V -->', command=lambda: oShaft.set_drive_speed(1 * int( entry_v_shaft.get()))) button4.grid(row=firstrow_shaft + 1, column=2) label_v_shaft = ttk.Label(velcontrl_frame, text='Velocity:') entry_v_shaft = ttk.Entry(velcontrl_frame) entry_v_shaft.insert(0, '0') label_v_shaft.grid(row=firstrow_shaft + 2, column=0) entry_v_shaft.grid(row=firstrow_shaft + 2, column=1) """ Abs Postion control """ entry_abs_pos_belt = ttk.Entry(absposcontrl_frame) entry_abs_pos_belt.insert(0, '') entry_abs_pos_belt.grid(row=2, column=1) entry_abs_pos_spindle = ttk.Entry(absposcontrl_frame) entry_abs_pos_spindle.insert(0, '') entry_abs_pos_spindle.grid(row=3, column=1) entry_abs_pos_shaft = ttk.Entry(absposcontrl_frame) entry_abs_pos_shaft.insert(0, '') entry_abs_pos_shaft.grid(row=4, column=1) button_goto_abs_pos = ttk.Button( absposcontrl_frame, text='go to X/Y/A - pos [mm]/[rad]', command=lambda: self.__gt.go_to_abs_pos( 1 * abs(int(entry_abs_pos_belt.get())), 1 * abs( int(entry_abs_pos_spindle.get())), 1 * abs( float(entry_abs_pos_shaft.get())))) button_goto_abs_pos.grid(row=5, column=1, sticky='W', pady=4) """ Rel Postion control """ entry_rel_pos_belt = ttk.Entry(relposcontrl_frame) entry_rel_pos_belt.insert(0, '0') entry_rel_pos_belt.grid(row=2, column=1) entry_rel_pos_spindle = ttk.Entry(relposcontrl_frame) entry_rel_pos_spindle.insert(0, '0') entry_rel_pos_spindle.grid(row=3, column=1) entry_rel_pos_shaft = ttk.Entry(relposcontrl_frame) entry_rel_pos_shaft.insert(0, '0') entry_rel_pos_shaft.grid(row=4, column=1) button_goto_rel_pos = ttk.Button( relposcontrl_frame, text='move by dx dy da [mm]/[rad]', command=lambda: self.__gt.go_to_rel_pos( 1 * int(entry_rel_pos_belt.get()), 1 * int( entry_rel_pos_spindle.get()), 1 * float(entry_rel_pos_shaft .get()))) button_goto_rel_pos.grid(row=5, column=1, sticky='W', pady=4) """ Manual Control """ button_manual_mode_belt = ttk.Button( man_contrl_frame, text=' Manual Mode Belt', command=lambda: oBelt.start_manual_mode()) button_manual_mode_belt.grid(row=firstrow_belt + 2, column=3) button_manual_mode_spindle = ttk.Button( man_contrl_frame, text=' Manual Mode Spindle', command=lambda: oSpindle.start_manual_mode()) button_manual_mode_spindle.grid(row=firstrow_spindle + 2, column=3) button_manual_mode_shaft = ttk.Button( man_contrl_frame, text=' Manual Mode Shaft', command=lambda: oShaft.start_manual_mode()) button_manual_mode_shaft.grid(row=firstrow_shaft + 2, column=3) """ EKF_Path Button """ button_ekf_path = ttk.Button( self, text='EKF-Path (old)', command=lambda: self.__gt.follow_wp_and_take_measurements()) button_ekf_path.grid(row=1, column=2) entry_num_plot_points = ttk.Entry(self) entry_num_plot_points.insert(0, '1000') entry_num_plot_points.grid(row=1, column=4) entry_log_lin_ekf = ttk.Entry(self) entry_log_lin_ekf.insert(0, 'log') entry_log_lin_ekf.grid(row=2, column=4) button_path = ttk.Button( self, text='WP-Path Following', command=lambda: self.__gt.follow_wp_path_opt_take_measurements( int(entry_num_plot_points.get()), entry_log_lin_ekf.get())) button_path.grid(row=1, column=3) """ Settings """ entry_max_speed_belt = ttk.Entry(self) entry_max_speed_belt.insert(0, '3000') entry_max_speed_belt.grid(row=3, column=6) button_max_speed_belt = ttk.Button( self, text='set max Speed Belt (<=3000!)', command=lambda: self.__gt.set_new_max_speed_x(1 * abs( int(entry_max_speed_belt.get())))) button_max_speed_belt.grid(row=3, column=5, sticky='W', pady=4) entry_max_speed_spindle = ttk.Entry(self) entry_max_speed_spindle.insert(0, '9000') entry_max_speed_spindle.grid(row=4, column=6) button_max_speed_spindle = ttk.Button( self, text='set max Speed Spindle (<=9000!)', command=lambda: self.__gt.set_new_max_speed_y(1 * abs( int(entry_max_speed_spindle.get())))) button_max_speed_spindle.grid(row=4, column=5, sticky='W', pady=4) entry_max_speed_shaft = ttk.Entry(self) entry_max_speed_shaft.insert(0, '123') entry_max_speed_shaft.grid(row=5, column=6) button_max_speed_shaft = ttk.Button( self, text='set max Speed Shaft (<=123!)', command=lambda: self.__gt.set_new_max_speed_y(1 * abs( int(entry_max_speed_shaft.get())))) button_max_speed_shaft.grid(row=5, column=5, sticky='W', pady=4) button_home_seq = ttk.Button( self, text='Initialize Home Position', command=lambda: self.__gt.start_go_home_seq_xya()) button_home_seq.grid(row=15, column=3, sticky='W', pady=4) """ Quit-Button """ button_quit = ttk.Button(self, text='Quit', command=self.quit) button_quit.grid(row=15, column=4, sticky='W', pady=4) label = ttk.Label(self, text='Start Page') label.grid(row=15, column=0) button1 = ttk.Button(self, text='Drive Settings', command=lambda: controller.show_frame(PageOne)) button1.grid(row=15, column=1) button_start_field_meas = ttk.Button( self, text='Start EM-Field Measurement', command=lambda: self.__gt.start_field_measurement_file_select()) button_start_field_meas.grid(row=8, column=5, sticky='W', pady=4) entry_log_lin_analyze = ttk.Entry(self) entry_log_lin_analyze.insert(0, 'log') entry_log_lin_analyze.grid(row=8, column=7) button_analyze_data = ttk.Button( self, text='Analyze Data', command=lambda: rf_tools.analyze_measdata_from_file( entry_log_lin_analyze.get())) button_analyze_data.grid(row=8, column=6, sticky='W', pady=4)
def __init__(self, parent): ttk.Frame.__init__(self, parent) self.armies = [] self.outputFilename = os.path.join( os.path.dirname(os.path.realpath(__file__)), '../VirtualMachine/src/main.cpp') self.terrain = "" self.shouldGenerateTerrain = False ttk.Label(self, text="Arena Settings", anchor="n", font=("Helvetica", 16)).pack(side="top", fill="x", pady=30) self.terrainFrame = ttk.Frame(self) self.terrainButton = ttk.Button(self.terrainFrame, text="Open arena terrain file...", command=self.selectTerrainFile) self.terrainButton.pack(side="right") self.terrainGenerateButton = ttk.Button( self.terrainFrame, text="Generate random terrain ", command=self.showTerrainGenerationOptions) self.terrainGenerateButton.pack(side="right") self.terrainButton.pack(side="right") self.terrainFrame.pack() ttk.Label(self).pack(pady=3) # spacing self.machineInstructions = NumberSetting( self, "Instructions per turn per machine", 50) self.sleepTime = NumberSetting(self, "Sleep time (in ms) per turn", 1000) self.availableCrystals = NumberSetting(self, "Available crystals", 120) self.maxCrystals = NumberSetting( self, "Maximum amount of crystals per cell", 20) self.robotHealth = NumberSetting(self, "Robot starting health", 100) self.robotMeleeAttack = NumberSetting(self, "Robot melee attack damage", 20) self.robotFuel = NumberSetting(self, "Robot starting fuel", 100, True) self.robotFuelUsage = NumberSetting(self, "Fuel usage per movement", 0.5, True) self.robotInstructionFuelUsage = NumberSetting( self, "Fuel usage per instruction", 0.01, True) # uncoment when implemented # self.robotShortAttack = NumberSetting(self, "Robot short range attack damage", 25) # self.robotLongAttack = NumberSetting(self, "Robot long range attack damage", 30) ttk.Label(self, text="Armies and robots", anchor="n", font=("Helvetica", 16)).pack(side="top", fill="x", pady=30) self.armyFrame = ttk.Frame(self) self.addArmy(False) self.addArmy(False) self.armyFrame.pack(fill="x") ttk.Button(self, text="Add Army", command=self.addArmy).pack(pady=10) ttk.Button(self, text="Save and Run!", command=self.run).pack(side="bottom", pady=30, ipadx=40, ipady=10)
input_text = tk.Text(input_panel, width=39, height=5, yscrollcommand=input_scroller.set) input_scroller.config(command=input_text.yview) output_panel = ttk.LabelFrame(seq_panel, text="Transformed Sequence") output_scroller = ttk.Scrollbar(output_panel, orient=tk.VERTICAL) output_text = tk.Text(output_panel, width=39, height=5, yscrollcommand=output_scroller.set) output_scroller.config(command=output_text.yview) # Buttons apply_button = ttk.Button(seq_panel, text="Apply") clear_button = ttk.Button(seq_panel, text="Clear") close_button = ttk.Button(seq_panel, text="Close", command=main_window.destroy) # Statusbar statustext = tk.StringVar() statusbar = ttk.Label(main_window, textvariable=statustext, relief=tk.GROOVE, padding=5) statustext.set("This is the statusbar") sizegrip = ttk.Sizegrip(statusbar) # Event methods def clear_output():
def __init__(self, parent, controller): tk.Frame.__init__(self, parent) self.controller = controller # The main page frame owns the two figures, the Animator and the Graph communicate # through the figures self.psiFig = Figure(figsize=(8, 6.5), dpi=100) #10# 8,8 # Initializing the particle into a default config, editable later #self.myPart = Particle1d((lambda x: x*x*0.5)(np.linspace(-10,10,2000)),gaussian(0,1,10)(np.linspace(-10,10,2000)), # N=2000,Lx=20.0,dt=.01,SOLVER=EigenSolver1d) X = np.linspace(-10, 10, 1024) V = creationFunctions.squareBarr(x0=0.1, width=.2, height=100)(X) V[np.abs(X) > 9.9] = 10000 self.myPart = Particle1d(V, creationFunctions.gaussian(-5, 1, 10)(X), N=1024, Lx=20.0, dt=.01, SOLVER=EigenSolver1d) # This is the object that will push updates to the figure self.anim = Animator(self.myPart, self.psiFig) #self.toggleXKCD() self.initGrid() figContainer = tk.Frame(self, relief="sunken") figContainer.pack(side=tk.LEFT) self.drawSpace = DrawableGraph(self.psiFig, figContainer) self.drawSpace.get_tk_widget().pack( side=tk.TOP) #grid(row=1,column=0)#, #rowspan=4,padx=5)#,sticky='EN')#pack(side=tk.BOTTOM) nonFigContainer = tk.Frame(self, relief="sunken") nonFigContainer.pack(side=tk.RIGHT) #constantContainer = tk.Frame(nonFigContainer, relief="sunken") nuclearContainer = tk.Frame(nonFigContainer, relief="sunken") nuclearContainer.pack(side=tk.TOP) label = tk.Label(nuclearContainer, text="Control Panel", font=("Comic", 18)) label.pack() quitButton = ttk.Button(nuclearContainer, text="Quit", command=self.controller.quit) quitButton.pack(side=tk.RIGHT) resetButton = ttk.Button(nuclearContainer, text='Reset', command=()) #TODO hook up reset resetButton.pack(side=tk.TOP) # Display |psi| or real(psi),im(psi) animOptionsContainer = tk.Frame(nonFigContainer, relief="sunken") animOptionsContainer.pack() subAnimCont = tk.Frame(animOptionsContainer, relief="sunken") subAnimCont.pack() updateButton = ttk.Button(subAnimCont, text="Redraw", command=self.changeGraph) updateButton.pack(side=tk.LEFT) playPauseButton = ttk.Button(subAnimCont, text='Play/Pause', command=globalV.pauseUnpause) playPauseButton.pack(side=tk.RIGHT) drawControlsContainer = tk.Frame(animOptionsContainer, relief="sunken") drawControlsContainer.pack() presetContainer = tk.Frame(animOptionsContainer, relief="sunken") presetContainer.pack() presetLabel = tk.Label(presetContainer, text="Presets", font=("Comic Sans", 12)) presetLabel.pack() self.presetDictionary = { 'Barrier Partial Reflection': ("gaussian(-5,1,10)(x)", "squareBarr(x0=0.1,width=.2,height=100)(x)"), 'Airy functions': ("gaussian(-5,1,13)(x)", "15*x"), 'Harmonic Oscillator': ("gaussian(0,2,5)(x)", ".5*x**2"), 'Coherent State w = 2': ("gaussian(6/sqrt(2),1/sqrt(2),0)(x)", ".5*4*x**2"), 'Abs(x) with Bumps': ("(x>-4)*(x<0)*(np.exp(1j*8*x)/np.sqrt(2))*(np.sin(np.pi*x/2))", "8*abs(x)+(x<7)*(x>5)*50*(5-x)*(x-7)-(x<-5)*(x>-7)*50*(-5-x)*(-x-7)" ), 'Coulomb Like': ("gaussian(3,1,-12)(x)", "-80/(.25*(x-3)**2+.5)-120/(.25*(x+3)**2+.5)") } self.preset = tk.StringVar() self.preset.set('Barrier Partial Reflection') presetsBox = ttk.Combobox(presetContainer, textvariable=self.preset) presetsBox['values'] = [key for key in self.presetDictionary] presetsBox.pack(side=tk.BOTTOM) self.preset.trace('w', self.presetCallback) #Todo: Connect up dontInterpBox self.dontInterp = tk.BooleanVar() dontInterpBox = ttk.Checkbutton(drawControlsContainer, text="Don't Interpo", variable=self.dontInterp) # dontInterpBox.pack(side = tk.RIGHT) self.startingK = tk.DoubleVar() # Initial K for psi kSlider = ttk.Scale(drawControlsContainer, orient="h", from_=-30, to=30, variable=self.startingK) kSlider.pack() displayOptionsContainer = tk.Frame(animOptionsContainer, relief="sunken") displayOptionsContainer.pack(expand=True, fill=tk.X) dispTypeButton = ttk.Button(displayOptionsContainer, text='Display Re{' + globalV.uniPsi + '}', command=self.anim.switchDisplayType) dispTypeButton.pack(side=tk.LEFT) #XKCDButton = ttk.Button(displayOptionsContainer, text="XKCD", command=self.toggleXKCD); XKCDButton.pack(side=tk.RIGHT) EnergyButton = ttk.Button(displayOptionsContainer, text="Energies", command=self.anim.energyDisplaySwitch) EnergyButton.pack(side=tk.LEFT) interpButton = ttk.Checkbutton(displayOptionsContainer, variable=None, command=self.anim.switchInterp) interpButton.pack(side=tk.RIGHT) # Text inputs for psi and V inputContainer = tk.Frame(nonFigContainer, relief="sunken") inputContainer.pack() inputLabel = ttk.Label(inputContainer, text="Direct input", font=("Comic", 16)) inputLabel.pack(side=tk.TOP) psiContainer = tk.Frame(inputContainer, relief="sunken") psiContainer.pack() psiDLabel = ttk.Label(psiContainer, text=globalV.uniPsi + "(x,0): example exp(-x**2 + 5*1j)") psiDLabel.pack(side=tk.TOP) self.textPsi = tk.StringVar() psiInputBox = tk.Entry(psiContainer, textvariable=self.textPsi) psiInputBox.pack(side=tk.LEFT) self.usePsi = tk.BooleanVar() psiCheckBox = ttk.Checkbutton(psiContainer, text="Enable", variable=self.usePsi) psiCheckBox.pack(side=tk.RIGHT) vContainer = tk.Frame(inputContainer, relief="sunken") vContainer.pack() vDLabel = ttk.Label(vContainer, text="V(x): example ((x<-5)|(x>5))*100") vDLabel.pack(side=tk.TOP) self.textV = tk.StringVar() vxInputBox = tk.Entry(vContainer, textvariable=self.textV) vxInputBox.pack(side=tk.LEFT) self.useV = tk.BooleanVar() vCheckBox = ttk.Checkbutton(vContainer, text="Enable", variable=self.useV) vCheckBox.pack(side=tk.RIGHT) #todo add other button functions solverContainer = tk.Frame(nonFigContainer, relief="sunken") solverContainer.pack(side=tk.BOTTOM) solverTypesContainer = tk.Frame(solverContainer, relief="sunken") solverTypesContainer.pack(side=tk.TOP, expand=True) FinDiffButton = ttk.Button( solverTypesContainer, text="Finite Difference", command=(lambda: self.myPart.reInit(SOLVER=EigenSolver1d))) FinDiffButton.pack(side=tk.LEFT, fill=tk.BOTH) SplitStepButton = ttk.Button( solverTypesContainer, text="Split Step Fourier", command=(lambda: self.myPart.reInit(SOLVER=SplitStepper1d))) SplitStepButton.pack(side=tk.RIGHT, fill=tk.BOTH) # Solver settings solverSettingsContainer = tk.Frame(solverContainer, relief="sunken") solverSettingsContainer.pack(side=tk.BOTTOM) stencilContainer = tk.Frame(solverSettingsContainer) stencilContainer.pack(side=tk.LEFT) stencilDescription = ttk.Label(stencilContainer, text="Hamiltonian Stencil") stencilDescription.pack() self.numSTerms = tk.IntVar() self.numSTerms.set(2) stencil3Button = ttk.Radiobutton(stencilContainer, text="3 Term", variable=self.numSTerms, value=1) stencil3Button.pack() stencil5Button = ttk.Radiobutton(stencilContainer, text="5 Term", variable=self.numSTerms, value=2) stencil5Button.pack() stencil7Button = ttk.Radiobutton(stencilContainer, text="7 Term", variable=self.numSTerms, value=3) stencil7Button.pack() stencil9Button = ttk.Radiobutton(stencilContainer, text="9 Term", variable=self.numSTerms, value=4) stencil9Button.pack() #Todo: fix placement of Nscale nContainer = tk.Frame(solverSettingsContainer, relief="sunken") nContainer.pack(side=tk.RIGHT) Ndescription = ttk.Label( nContainer, text="Samples: 1024", ) Ndescription.pack(side=tk.TOP) self.vectorLength = tk.IntVar() self.vectorLength.set(10) NScale = ttk.Scale( nContainer, orient='v', from_=3, to=13, variable=self.vectorLength, command=lambda x: self.nPointsSliderCallback(Ndescription)) NScale.pack() # eigenSlider and coefficients altFigSettingsContainer = tk.Frame(figContainer, relief=tk.RAISED, borderwidth=1) altFigSettingsContainer.pack(side=tk.BOTTOM, expand=True, fill=tk.BOTH) self.eigenNum = tk.IntVar() fnum = tk.Label(altFigSettingsContainer) fnum.pack(side=tk.LEFT) cNum = tk.Label(altFigSettingsContainer) cNum.pack(side=tk.RIGHT) self.eigenFunctionSlider = ttk.Scale( altFigSettingsContainer, orient="h", from_=0, to=90, variable=self.eigenNum, command=lambda x: self.altGraphSliderCallback((fnum, cNum))) self.eigenFunctionSlider.pack(expand=True, fill=tk.BOTH) # Button for controlling altgraph output self.altGraphType = tk.IntVar() energyBasis = ttk.Radiobutton(altFigSettingsContainer, text="psi in H basis", variable=self.altGraphType, value=0) energyBasis.pack(side=tk.RIGHT)
def set_frame(self, root): self.canvas = tk.Canvas(root) self.lblframe = tk.Frame(self.canvas) self.vsby = tk.Scrollbar(root, orient="vertical", command=self.canvas.yview) self.vsbx = tk.Scrollbar(root, orient="horizontal", command=self.canvas.xview) self.canvas.configure(yscrollcommand=self.vsby.set, xscrollcommand=self.vsbx.set) self.vsbx.pack(side="bottom", fill="x") self.vsby.pack(side="right", fill="y") self.canvas.pack(side="left", fill="both", expand=True) self.canvas.create_window((4, 4), window=self.lblframe, anchor="nw", tags="self.lblframe") self.lblframe.bind("<Configure>", self.OnFrameConfigure) #self.lblframe = ttk.Frame(root) #self.lblframe.grid_columnconfigure(1, weight=1) entries = {} stringvars = {} row_id = 0 set_btn = ttk.Button(self.lblframe, text='Set', command=self.set_params) set_btn.grid(row=row_id, column=3, sticky="ew") refresh_btn = ttk.Button(self.lblframe, text='Refresh', command=self.get_params) refresh_btn.grid(row=row_id, column=4, sticky="ew") recalc_btn = ttk.Button(self.lblframe, text='Recalc', command=self.recalc) recalc_btn.grid(row=row_id, column=5, sticky="ew") row_id += 1 for idx, field in enumerate(self.shared_fields): lbl = ttk.Label(self.lblframe, text=field, anchor='w', width=8) lbl.grid(row=row_id, column=idx + 2, sticky="ew") if field in self.entry_fields: ent = ttk.Entry(self.lblframe, width=4) ent.grid(row=row_id + 1, column=idx + 2, sticky="ew") ent.insert(0, "0") entries[field] = ent elif field in self.status_fields: v = get_type_var(self.field_types[field]) lab = ttk.Label(self.lblframe, textvariable=v, anchor='w', width=8) lab.grid(row=row_id + 1, column=idx + 2, sticky="ew") v.set('0') stringvars[field] = v row_id += 2 local_entry_fields = [ f for f in self.entry_fields if f not in self.shared_fields ] local_status_fields = [ f for f in self.status_fields if f not in self.shared_fields ] fields = ['assets'] + local_entry_fields + local_status_fields for idx, field in enumerate(fields): lbl = ttk.Label(self.lblframe, text=field, anchor='w', width=8) lbl.grid(row=row_id, column=idx, sticky="ew") row_id += 1 for underlier in self.underliers: under_key = ','.join(underlier) inst_lbl = ttk.Label(self.lblframe, text=under_key, anchor="w", width=8) inst_lbl.grid(row=row_id, column=0, sticky="ew") col_id = 1 entries[under_key] = {} for idx, field in enumerate(local_entry_fields): ent = ttk.Entry(self.lblframe, width=5) ent.grid(row=row_id, column=col_id + idx, sticky="ew") ent.insert(0, "0") entries[under_key][field] = ent col_id += len(local_entry_fields) stringvars[under_key] = {} for idx, field in enumerate(local_status_fields): v = get_type_var(self.field_types[field]) lab = ttk.Label(self.lblframe, textvariable=v, anchor='w', width=8) lab.grid(row=row_id, column=col_id + idx, sticky="ew") v.set('0') stringvars[under_key][field] = v row_id += 1 self.entries = entries self.stringvars = stringvars #self.lblframe.pack(side="top", fill="both", expand=True, padx=10, pady=10) self.get_params() return
def __init__(self, parent, controller): """ Initializes most of the variables ( simple variables and objects variables like Global and Queue ( see GlobalBS class and PDFQueue class ) ), the Option widgets, the Images widgets, the Button widgets, Label widgets and Scale widgets ( see TKinter ). """ tk.Frame.__init__(self, parent) self.controller = controller controller.logger.info("Menu is created.") # VARIABLES self.dpiscale = tk.IntVar() self.pagescale = tk.IntVar() self.amountdscale = tk.IntVar() self.amounttscale = tk.IntVar() self.daltotype = tk.StringVar() self.dpiscale.set(72) self.pagescale.set(1) self.amountdscale.set(1) self.amounttscale.set(1) self.daltotype.set("normale") self.Queue = QueuePDF.PDFQueue() self.Global = globalBS() # OPTION WIDGET # self.daltotypes = ["normal_vision", "protanope_vision", "deuteranope_vision", "tritanope_vision"] self.daltotypes = [ "normale", "protanopie", "deuteranopie", "tritanopie" ] self.daltotypeoption = tk.OptionMenu(self, self.daltotype, *self.daltotypes) self.daltotypeoption.place(x=340, y=580) # IMAGES WIDGET self.imageconvertir = Image.open(self.Global.iconfile + "convert.png") self.photoconvertir = ImageTk.PhotoImage(self.imageconvertir) self.imageremovepdf = Image.open(self.Global.iconfile + "remove60-60.png") self.photoremovepdf = ImageTk.PhotoImage(self.imageremovepdf) self.imagepause = Image.open(self.Global.iconfile + "pause60-60.png") self.photopause = ImageTk.PhotoImage(self.imagepause) self.imagepdf = Image.open(self.Global.iconfile + "sign-add-icon.png2.png") self.photopdf = ImageTk.PhotoImage(self.imagepdf) self.imageconfig = Image.open(self.Global.iconfile + "check60-60.png") self.photoconfid = ImageTk.PhotoImage(self.imageconfig) self.imagechrono = Image.open(self.Global.iconfile + "chrono.png") self.photochrono = ImageTk.PhotoImage(self.imagechrono) self.imagetest = Image.open(self.Global.iconfile + "Webp.net-resizeimage.png") self.phototest = ImageTk.PhotoImage(self.imagetest) self.imagepdfadd = Image.open(self.Global.iconfile + "pdf150-150.png") self.photopdfadd = ImageTk.PhotoImage(self.imagepdfadd) # BUTTONS WIDGET and their LABEL self.button17 = ttk.Button(self, text="INFORMATION SUR LE LOGICIEL", command=lambda: self.CheckInfo()) self.button17.place(x=600, y=30) self.button2 = ttk.Button(self, image=self.photoconvertir, command=lambda: self.lancerconversion()) self.button2.place(x=30, y=340) self.labeldel = tk.Label(self, text="convertir:", font=("Verdana", 7, "bold"), fg="dark slate gray").place(x=37, y=410) self.abort_button = ttk.Button(self, image=self.photoremovepdf, command=lambda: self.abortconversion()) self.abort_button.place(x=190, y=730) self.labeldel = tk.Label(self, text="annuler:", font=("Verdana", 7, "bold"), fg="dark slate gray").place(x=200, y=800) self.abort_button = ttk.Button( self, image=self.photopause, command=lambda: self.timeoutconversion()) self.abort_button.place(x=110, y=730) self.labeldel = tk.Label(self, text="pause:", font=("Verdana", 7, "bold"), fg="dark slate gray").place(x=125, y=800) self.abort_button = ttk.Button( self, image=self.photoconvertir, command=lambda: self.restartconversion()) self.abort_button.place(x=30, y=730) self.labeldel = tk.Label(self, text="continuer:", font=("Verdana", 7, "bold"), fg="dark slate gray").place(x=37, y=800) self.labeladd = tk.Label(self, text="ajouter:", font=("Verdana", 7, "bold"), fg="dark slate gray").place(x=192, y=240) self.pdf_button = ttk.Button(self, image=self.photopdf, command=lambda: self.addpdf()) self.pdf_button.place(x=180, y=170) self.labeldel = tk.Label(self, text="supprimer:", font=("Verdana", 7, "bold"), fg="dark slate gray").place(x=185, y=328) self.pdf_button = ttk.Button(self, image=self.photoremovepdf, command=lambda: self.reomvepdf()) self.pdf_button.place(x=180, y=260) self.config_button = ttk.Button(self, image=self.photoconfid, command=lambda: self.showprogress()) self.config_button.place(x=780, y=620) self.labeldel = tk.Label(self, text="progression:", font=("Verdana", 7, "bold"), fg="dark slate gray").place(x=780, y=690) self.button4 = ttk.Button(self, image=self.photochrono, command=lambda: self.calcultemps()) self.button4.place(x=110, y=340) self.labeldel = tk.Label(self, text="chrono:", font=("Verdana", 7, "bold"), fg="dark slate gray").place(x=123, y=410) self.button3 = ttk.Button(self, text="LANCER LE TEST", command=lambda: self.lancertest()) self.button3.place(x=210, y=430) # LABEL WIDGET self.label0 = tk.Label(self, text="Sélectionner un pdf :", font=("Verdana", 14, "bold"), fg="dark slate gray").place(x=30, y=130) self.label1 = tk.Label(self, text="Configuration :", font=("Verdana", 14, "bold"), fg="dark slate gray").place(x=30, y=430) self.label2 = tk.Label(self, text="Sélectionner votre type de daltonisme : ", font=("Verdana", 10, "bold"), fg="dark slate gray").place(x=40, y=580) self.label3 = tk.Label(self, text="Sévérité du daltonisme : ", font=("Verdana", 10, "bold"), fg="dark slate gray").place(x=40, y=490) self.label4 = tk.Label(self, text="Séverité de la conversion : ", font=("Verdana", 10, "bold"), fg="dark slate gray").place(x=40, y=540) self.label5 = tk.Label(self, text="Sélectionner les dpi : ", font=("Verdana", 10, "bold"), fg="dark slate gray").place(x=40, y=630) self.label6 = tk.Label(self, text="pdf en cours de conversion :", font=("Verdana", 14, "bold"), fg="dark slate gray").place(x=30, y=690) self.label7 = tk.Label(self, image=self.phototest).place(x=390, y=0) self.label8 = ttk.Label(self, image=self.photopdfadd).place(x=20, y=180) # SCALE WIDGET self.pagescale = tk.Scale(self, from_=20, to=1, orient="horizontal") self.pagescale.place(x=320, y=412) self.labeldel = tk.Label(self, text="page:", font=("Verdana", 7, "bold"), fg="dark slate gray").place(x=350, y=450) self.dpiscale = tk.Scale(self, from_=300, to=72, orient="horizontal") self.dpiscale.place(x=210, y=610) self.amountdscale = tk.Scale(self, from_=1, to=10, orient="horizontal") self.amountdscale.place(x=230, y=470) self.amounttscale = tk.Scale(self, from_=1, to=10, orient="horizontal") self.amounttscale.place(x=250, y=520)
def populate(self): vol_labels = [ 'Expiry', 'Under', 'Df', 'Fwd', 'Atm', 'V90', 'V75', 'V25', 'V10', 'Updated' ] vol_types = [ 'string', 'string', 'float', 'float', 'float', 'float', 'float', 'float', 'float', 'float' ] inst_labels = [ 'Name', 'Price', 'BidPrice', 'BidVol', 'BidIV', 'AskPrice', 'AskVol', 'AskIV', 'Volume', 'OI' ] under_labels = [ 'Name', 'Price', 'BidPrice', 'BidVol', 'AskPrice', 'AskVol', 'UpLimit', 'DownLimit', 'Volume', 'OI' ] row_id = 0 col_id = 0 for under_id, (expiry, strikes, cont_mth, under) in enumerate( zip(self.expiries, self.strikes, self.cont_mth, self.underliers)): col_id = 0 for idx, vlbl in enumerate(vol_labels): tk.Label(self.frame, text=vlbl).grid(row=row_id, column=col_id + idx) tk.Label(self.frame, textvariable=self.stringvars['Volgrid'][expiry] [vlbl]).grid(row=row_id + 1, column=col_id + idx) ttk.Button(self.frame, text='Refresh', command=self.get_T_table).grid(row=row_id, column=10, columnspan=2) ttk.Button(self.frame, text='CalcRisk', command=self.recalc_risks).grid(row=row_id + 1, column=10, columnspan=2) ttk.Button(self.frame, text='CalibVol', command=self.calib_volgrids).grid(row=row_id, column=12, columnspan=2) ttk.Button(self.frame, text='RiskGroup', command=self.show_risks).grid(row=row_id + 1, column=12, columnspan=2) row_id += 2 col_id = 0 inst = self.underliers[under_id] for idx, ulbl in enumerate(under_labels): tk.Label(self.frame, text=ulbl).grid(row=row_id, column=col_id + idx) tk.Label(self.frame, textvariable=self.root.stringvars[inst][ulbl]).grid( row=row_id + 1, column=col_id + idx) row_id += 2 col_id = 0 for idx, instlbl in enumerate(inst_labels + ['strike']): tk.Label(self.frame, text=instlbl).grid(row=row_id, column=col_id + idx) if instlbl != 'strike': tk.Label(self.frame, text=instlbl).grid( row=row_id, column=col_id + 2 * len(inst_labels) - idx) for idy, strike in enumerate(strikes): if instlbl == 'strike': tk.Label(self.frame, text=str(strike), padx=10).grid(row=row_id + 1 + idy, column=col_id + idx) else: key1 = (cont_mth, 'C', strike) if key1 in self.opt_dict: inst1 = self.opt_dict[key1] tk.Label(self.frame, textvariable=self.root.stringvars[inst1] [instlbl], padx=10).grid(row=row_id + 1 + idy, column=col_id + idx) key2 = (cont_mth, 'P', strike) if key1 in self.opt_dict: inst2 = self.opt_dict[key2] tk.Label(self.frame, textvariable=self.root.stringvars[inst2] [instlbl], padx=10).grid(row=row_id + 1 + idy, column=col_id + 2 * len(inst_labels) - idx) row_id = row_id + len(strikes) + 2 self.get_T_table() return
import tkinter.colorchooser ImportError: No module named tkinter.colorchooser >>> import ttk >>> import tkColorChooser >>> tkColorChooser.askcolor() (None, None) >>> canvas=tk.Canvas(width=600, height=600) >>> canvas.pack() >>> random_rectangle(400, 400, 'red') >>> mainloop() Traceback (most recent call last): File "<pyshell#43>", line 1, in <module> mainloop() NameError: name 'mainloop' is not defined >>> ttk.Button('click here') Traceback (most recent call last): File "<pyshell#44>", line 1, in <module> ttk.Button('click here') File "/usr/lib/python2.7/lib-tk/ttk.py", line 610, in __init__ Widget.__init__(self, master, "ttk::button", kw) File "/usr/lib/python2.7/lib-tk/ttk.py", line 555, in __init__ Tkinter.Widget.__init__(self, master, widgetname, kw=kw) File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2085, in __init__ BaseWidget._setup(self, master, cnf) File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2063, in _setup self.tk = master.tk AttributeError: 'str' object has no attribute 'tk' >>> window=ttk()
def config_settings(self): entry_fields = [ 'MarketOrderTickMultiple', 'CancelProtectPeriod', 'MarginCap' ] label_fields = ['ScurDay', 'EodFlag', 'Initialized'] lbl_frame = ttk.Labelframe(self.settings_win) row_idx = 0 for field1, field2 in zip(entry_fields, label_fields): #row = tk.Frame(root) lab = ttk.Label(lbl_frame, text=field1 + ": ", anchor='w') lab.grid(column=0, row=row_idx, sticky="ew") ent = ttk.Entry(lbl_frame, width=4) self.entries[field1] = ent ent.insert(0, "0") ent.grid(column=1, row=row_idx, sticky="ew") v = tk.IntVar() lab1 = ttk.Label(lbl_frame, text=field2 + ": ", anchor='w') self.stringvars[field2] = v lab1.grid(column=2, row=row_idx, sticky="ew") lab2 = ttk.Label(lbl_frame, textvariable=v, anchor='w') lab2.grid(column=3, row=row_idx, sticky="ew") row_idx += 1 pnl_fields = ['CurrCapital', 'PrevCapital', 'PnlTotal'] margin_fields = ['LockedMargin', 'UsedMargin', 'Available'] for field1, field2 in zip(pnl_fields, margin_fields): #row = tk.Frame(root) lab1 = ttk.Label(lbl_frame, text=field1 + ": ", anchor='w') lab1.grid(column=0, row=row_idx, sticky="ew") v1 = tk.DoubleVar() lab2 = ttk.Label(lbl_frame, textvariable=v1, anchor='w') self.stringvars[field1] = v1 lab2.grid(column=1, row=row_idx, sticky="ew") lab3 = ttk.Label(lbl_frame, text=field2 + ": ", anchor='w') lab3.grid(column=2, row=row_idx, sticky="ew") v2 = tk.DoubleVar() lab4 = ttk.Label(lbl_frame, textvariable=v2, anchor='w') self.stringvars[field2] = v2 lab4.grid(column=3, row=row_idx, sticky="ew") row_idx += 1 all_fields = entry_fields + label_fields + pnl_fields + margin_fields setup_setbtn = ttk.Button( lbl_frame, text='SetParam', command=lambda: self.set_agent_params(entry_fields)) setup_setbtn.grid(column=0, row=row_idx, sticky="ew") setup_loadbtn = ttk.Button( lbl_frame, text='LoadParam', command=lambda: self.get_agent_params(all_fields)) setup_loadbtn.grid(column=1, row=row_idx, sticky="ew") setup_loadbtn = ttk.Button(lbl_frame, text='ReCalc', command=self.recalc_margin) setup_loadbtn.grid(column=2, row=row_idx, sticky="ew") setup_loadbtn = ttk.Button(lbl_frame, text='RunEOD', command=self.run_eod) setup_loadbtn.grid(column=3, row=row_idx, sticky="ew") setup_qrybtn = ttk.Button(lbl_frame, text='QueryInst', command=self.qry_agent_inst) setup_qrybtn.grid(column=4, row=row_idx, sticky="ew") row_idx += 1 field = 'QryInst' lab = ttk.Label(lbl_frame, text=field, anchor='w') lab.grid(column=0, row=row_idx, sticky="ew") ent = ttk.Entry(lbl_frame, width=4) ent.grid(column=0, row=row_idx + 1, sticky="ew") self.entries[field] = ent inst_fields = [ 'Price', 'PrevClose', 'Volume', 'OI', 'AskPrice', 'AskVol', 'BidPrice', 'BidVol', 'UpLimit', 'DownLimit' ] for idx, field in enumerate(inst_fields): lab1 = ttk.Label(lbl_frame, text=field, anchor='w') lab1.grid(column=idx + 1, row=row_idx, sticky="ew") v = tk.DoubleVar() lab2 = ttk.Label(lbl_frame, textvariable=v, anchor='w') self.stringvars['Insts.' + field] = v lab2.grid(column=idx + 1, row=row_idx + 1, sticky="ew") lbl_frame.pack(side="top", fill="both", expand=True, padx=10, pady=10) self.get_agent_params(all_fields)
def __init__(self, master=None, year=None, month=None, firstweekday=calendar.MONDAY, locale=None, activebackground='#b1dcfb', activeforeground='black', selectbackground='#003eff', selectforeground='white', command=None, borderwidth=1, relief="solid", on_click_month_button=None): """ WIDGET OPTIONS locale, firstweekday, year, month, selectbackground, selectforeground, activebackground, activeforeground, command, borderwidth, relief, on_click_month_button """ if year is None: year = self.datetime.now().year if month is None: month = self.datetime.now().month self._selected_date = None self._sel_bg = selectbackground self._sel_fg = selectforeground self._act_bg = activebackground self._act_fg = activeforeground self.on_click_month_button = on_click_month_button self._selection_is_visible = False self._command = command ttk.Frame.__init__(self, master, borderwidth=borderwidth, relief=relief) self.bind("<FocusIn>", lambda event: self.event_generate('<<DatePickerFocusIn>>')) self.bind("<FocusOut>", lambda event: self.event_generate('<<DatePickerFocusOut>>')) self._cal = get_calendar(locale, firstweekday) # custom ttk styles style = ttk.Style() style.layout('L.TButton', ([('Button.focus', { 'children': [('Button.leftarrow', None)] })])) style.layout('R.TButton', ([('Button.focus', { 'children': [('Button.rightarrow', None)] })])) self._font = tkFont.Font() self._header_var = StringVar() # header frame and its widgets hframe = ttk.Frame(self) lbtn = ttk.Button(hframe, style='L.TButton', command=self._on_press_left_button) lbtn.pack(side=LEFT) self._header = ttk.Label(hframe, width=15, anchor=CENTER, textvariable=self._header_var) self._header.pack(side=LEFT, padx=12) rbtn = ttk.Button(hframe, style='R.TButton', command=self._on_press_right_button) rbtn.pack(side=LEFT) hframe.grid(columnspan=7, pady=4) self._day_labels = {} days_of_the_week = self._cal.formatweekheader(3).split() for i, day_of_the_week in enumerate(days_of_the_week): Tkinter.Label(self, text=day_of_the_week, background='grey90').grid(row=1, column=i, sticky=N + E + W + S) for i in range(6): for j in range(7): self._day_labels[i, j] = label = Tkinter.Label(self, background="white") label.grid(row=i + 2, column=j, sticky=N + E + W + S) label.bind( "<Enter>", lambda event: event.widget.configure( background=self._act_bg, foreground=self._act_fg)) label.bind( "<Leave>", lambda event: event.widget.configure(background="white")) label.bind("<1>", self._pressed) # adjust its columns width font = tkFont.Font() maxwidth = max(font.measure(text) for text in days_of_the_week) for i in range(7): self.grid_columnconfigure(i, minsize=maxwidth, weight=1) self._year = None self._month = None # insert dates in the currently empty calendar self._build_calendar(year, month)
def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#d9d9d9' # X11 color: 'gray85' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.',background=_bgcolor) self.style.configure('.',foreground=_fgcolor) self.style.configure('.',font="TkDefaultFont") self.style.map('.',background= [('selected', _compcolor), ('active',_ana2color)]) top.geometry("595x433+575+303") top.title("IEEE METU NCC Member System") top.configure(background="#d9d9d9") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") self.labelBackground = Label(top) self.labelBackground.place(relx=-0.01, rely=-0.01, height=411, width=604) self.labelBackground.configure(activebackground="#f9f9f9") self.labelBackground.configure(activeforeground="black") self.labelBackground.configure(background="#d9d9d9") self.labelBackground.configure(disabledforeground="#a3a3a3") self.labelBackground.configure(foreground="#000000") self.labelBackground.configure(highlightbackground="#d9d9d9") self.labelBackground.configure(highlightcolor="black") self._img1 = PhotoImage(file="Untitled-1.png") self.labelBackground.configure(image=self._img1) self.labelBackground.configure(text='''Label''') self.menubar = Menu(top,font="TkMenuFont",bg=_bgcolor,fg=_fgcolor) top.configure(menu = self.menubar) self.menubar.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=member_support.pushMainMenu, font="TkMenuFont", foreground="#000000", label="Main Menu", state=DISABLED) self.member_operations = Menu(top,tearoff=0) self.menubar.add_cascade(menu=self.member_operations, activebackground="#d9d9d9", activeforeground="#000000", background="#d9d9d9", font="TkMenuFont", foreground="#000000", label="Member Operations", state=DISABLED) self.member_operations.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=member_support.pushAddMember, font="TkMenuFont", foreground="#000000", label="Add Member") self.member_operations.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=member_support.pushEditMember, font="TkMenuFont", foreground="#000000", label="Edit / Remove Member") self.member_operations.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=member_support.pushMemberList, font="TkMenuFont", foreground="#000000", label="Member List") self.event_operations = Menu(top,tearoff=0) self.menubar.add_cascade(menu=self.event_operations, activebackground="#d9d9d9", activeforeground="#000000", background="#d9d9d9", font="TkMenuFont", foreground="#000000", label="Event Operations", state=DISABLED) self.event_operations.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=member_support.pushCreateEvent, font="TkMenuFont", foreground="#000000", label="Create Event") self.event_operations.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=member_support.pushTakeAttend, font="TkMenuFont", foreground="#000000", label="Take Attendance") self.event_operations.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=member_support.pushEventList, font="TkMenuFont", foreground="#000000", label="Event List") self.menubar.add_command( activebackground="#d8d8d8", activeforeground="#000000", background="#d9d9d9", command=member_support.pushChangePassword, font="TkMenuFont", foreground="#000000", label="Change Password", state=DISABLED) self.buttonLogout = ttk.Button(top) self.buttonLogout.place(relx=-0.01, rely=0.93, height=30, width=606) self.buttonLogout.configure(command=member_support.pushLogout) self.buttonLogout.configure(takefocus="") self.buttonLogout.configure(text='''Logout''') self.frameLogin = Frame(top) self.frameLogin.place(relx=-0.01, rely=-0.02, relheight=1.05 , relwidth=1.01) self.frameLogin.configure(relief=GROOVE) self.frameLogin.configure(borderwidth="2") self.frameLogin.configure(relief=GROOVE) self.frameLogin.configure(background="#d9d9d9") self.frameLogin.configure(highlightbackground="#d9d9d9") self.frameLogin.configure(highlightcolor="black") self.frameLogin.configure(width=605) self.TEntry1 = ttk.Entry(self.frameLogin) self.TEntry1.place(relx=0.43, rely=0.37, relheight=0.05, relwidth=0.23) self.TEntry1.configure(textvariable=member_support.txtLoginSchoolID) self.TEntry1.configure(validate="focusout") self.TEntry1.focus() self.TEntry1.configure(cursor="ibeam") self.TEntry2 = ttk.Entry(self.frameLogin) self.TEntry2.place(relx=0.43, rely=0.46, relheight=0.05, relwidth=0.23) self.TEntry2.configure(textvariable=member_support.txtLoginPassword) self.TEntry2.configure(takefocus="") self.TEntry2.configure(show="*") self.TEntry2.configure(cursor="ibeam") self.TEntry2.bind('<Return>',lambda e:member_support.loginButtonReturn(e)) self.TButton2 = ttk.Button(self.frameLogin) self.TButton2.place(relx=0.32, rely=0.53, height=30, width=209) self.TButton2.configure(takefocus="") self.TButton2.configure(command=member_support.pushLoginButton) self.TButton2.configure(text='''Login''') self.TButton2.bind('<Return>',lambda e:member_support.loginButtonReturn(e)) self.TLabel1 = ttk.Label(self.frameLogin) self.TLabel1.place(relx=0.32, rely=0.37, height=19, width=60) self.TLabel1.configure(background="#d9d9d9") self.TLabel1.configure(foreground="#000000") self.TLabel1.configure(font="TkDefaultFont") self.TLabel1.configure(relief=FLAT) self.TLabel1.configure(text='''School ID :''') self.TLabel2 = ttk.Label(self.frameLogin) self.TLabel2.place(relx=0.32, rely=0.46, height=19, width=60) self.TLabel2.configure(background="#d9d9d9") self.TLabel2.configure(foreground="#000000") self.TLabel2.configure(font="TkDefaultFont") self.TLabel2.configure(relief=FLAT) self.TLabel2.configure(text='''Password :''') self.frameAddMember = Frame(top) self.frameAddMember.place(relx=-0.01, rely=-0.02, relheight=0 , relwidth=0) self.frameAddMember.configure(relief=GROOVE) self.frameAddMember.configure(borderwidth="2") self.frameAddMember.configure(relief=GROOVE) self.frameAddMember.configure(background="#d9d9d9") self.frameAddMember.configure(highlightbackground="#d9d9d9") self.frameAddMember.configure(highlightcolor="black") self.frameAddMember.configure(width=605) self.TEntry3 = ttk.Entry(self.frameAddMember) self.TEntry3.place(relx=0.41, rely=0.27, relheight=0.05, relwidth=0.21) self.TEntry3.configure(textvariable=member_support.txtAddUID) self.TEntry3.configure(cursor="ibeam") self.TEntry3.bind('<Return>',lambda e:member_support.addUIDReturn(e)) self.TEntry4 = ttk.Entry(self.frameAddMember) self.TEntry4.place(relx=0.41, rely=0.36, relheight=0.05, relwidth=0.21) self.TEntry4.configure(textvariable=member_support.txtAddName) self.TEntry4.configure(takefocus="") self.TEntry4.configure(cursor="ibeam") self.TEntry5 = ttk.Entry(self.frameAddMember) self.TEntry5.place(relx=0.41, rely=0.44, relheight=0.05, relwidth=0.21) self.TEntry5.configure(textvariable=member_support.txtAddSurname) self.TEntry5.configure(takefocus="") self.TEntry5.configure(cursor="ibeam") self.TEntry6 = ttk.Entry(self.frameAddMember) self.TEntry6.place(relx=0.41, rely=0.53, relheight=0.05, relwidth=0.21) self.TEntry6.configure(textvariable=member_support.txtAddSchoolID) self.TEntry6.configure(takefocus="") self.TEntry6.configure(cursor="ibeam") self.TEntry7 = ttk.Entry(self.frameAddMember) self.TEntry7.place(relx=0.41, rely=0.62, relheight=0.05, relwidth=0.21) self.TEntry7.configure(textvariable=member_support.txtAddPhone) self.TEntry7.configure(takefocus="") self.TEntry7.configure(cursor="ibeam") self.TEntry7.bind('<Return>',lambda e:member_support.buttonAddReturn(e)) self.buttonAddMember = ttk.Button(self.frameAddMember) self.buttonAddMember.place(relx=0.32, rely=0.7, height=30, width=190) self.buttonAddMember.configure(command=member_support.pushAddMemberButton) self.buttonAddMember.configure(takefocus="") self.buttonAddMember.configure(text='''Add''') self.buttonAddMember.bind('<Return>',lambda e:member_support.buttonAddReturn(e)) self.TLabel3 = ttk.Label(self.frameAddMember) self.TLabel3.place(relx=0.36, rely=0.27, height=19, width=29) self.TLabel3.configure(background="#d9d9d9") self.TLabel3.configure(foreground="#000000") self.TLabel3.configure(font="TkDefaultFont") self.TLabel3.configure(relief=FLAT) self.TLabel3.configure(text='''UID :''') self.TLabel4 = ttk.Label(self.frameAddMember) self.TLabel4.place(relx=0.33, rely=0.36, height=19, width=42) self.TLabel4.configure(background="#d9d9d9") self.TLabel4.configure(foreground="#000000") self.TLabel4.configure(font="TkDefaultFont") self.TLabel4.configure(relief=FLAT) self.TLabel4.configure(text='''Name :''') self.TLabel5 = ttk.Label(self.frameAddMember) self.TLabel5.place(relx=0.31, rely=0.44, height=19, width=57) self.TLabel5.configure(background="#d9d9d9") self.TLabel5.configure(foreground="#000000") self.TLabel5.configure(font="TkDefaultFont") self.TLabel5.configure(relief=FLAT) self.TLabel5.configure(text='''Surname :''') self.TLabel6 = ttk.Label(self.frameAddMember) self.TLabel6.place(relx=0.31, rely=0.53, height=19, width=60) self.TLabel6.configure(background="#d9d9d9") self.TLabel6.configure(foreground="#000000") self.TLabel6.configure(font="TkDefaultFont") self.TLabel6.configure(relief=FLAT) self.TLabel6.configure(text='''School ID :''') self.TLabel7 = ttk.Label(self.frameAddMember) self.TLabel7.place(relx=0.33, rely=0.62, height=19, width=44) self.TLabel7.configure(background="#d9d9d9") self.TLabel7.configure(foreground="#000000") self.TLabel7.configure(font="TkDefaultFont") self.TLabel7.configure(relief=FLAT) self.TLabel7.configure(text='''Phone :''') self.TLabel8 = ttk.Label(self.frameAddMember) self.TLabel8.place(relx=0.32, rely=0.81, height=19, width=196) self.TLabel8.configure(background="#d9d9d9") self.TLabel8.configure(foreground="#000000") self.TLabel8.configure(font="TkDefaultFont") self.TLabel8.configure(relief=FLAT) self.TLabel8.configure(textvariable=member_support.txtLabelAddInfo) self.frameEditMember = Frame(top) self.frameEditMember.place(relx=-0.01, rely=-0.02, relheight=0 , relwidth=0) self.frameEditMember.configure(relief=GROOVE) self.frameEditMember.configure(borderwidth="2") self.frameEditMember.configure(relief=GROOVE) self.frameEditMember.configure(background="#d9d9d9") self.frameEditMember.configure(highlightbackground="#d9d9d9") self.frameEditMember.configure(highlightcolor="black") self.frameEditMember.configure(width=125) self.TEntry8 = ttk.Entry(self.frameEditMember) self.TEntry8.place(relx=0.4, rely=0.2, relheight=0.05, relwidth=0.21) self.TEntry8.configure(textvariable=member_support.txtEditNum) self.TEntry8.configure(takefocus="") self.TEntry8.configure(cursor="ibeam") self.TEntry8.bind('<Return>',lambda e:member_support.editUIDSchoolReturn(e)) self.entryEditUID = ttk.Entry(self.frameEditMember) self.entryEditUID.place(relx=0.4, rely=0.29, relheight=0.05 , relwidth=0.21) READONLY = 'readonly' self.entryEditUID.configure(state=READONLY) self.entryEditUID.configure(textvariable=member_support.txtEditUID) self.entryEditUID.configure(takefocus="") self.entryEditUID.configure(cursor="ibeam") self.entryEditName = ttk.Entry(self.frameEditMember) self.entryEditName.place(relx=0.4, rely=0.37, relheight=0.05 , relwidth=0.21) READONLY = 'readonly' self.entryEditName.configure(state=READONLY) self.entryEditName.configure(textvariable=member_support.txtEditName) self.entryEditName.configure(takefocus="") self.entryEditName.configure(cursor="ibeam") self.entryEditSurname = ttk.Entry(self.frameEditMember) self.entryEditSurname.place(relx=0.4, rely=0.46, relheight=0.05 , relwidth=0.21) READONLY = 'readonly' self.entryEditSurname.configure(state=READONLY) self.entryEditSurname.configure(textvariable=member_support.txtEditSurname) self.entryEditSurname.configure(takefocus="") self.entryEditSurname.configure(cursor="ibeam") self.entryEditSchool = ttk.Entry(self.frameEditMember) self.entryEditSchool.place(relx=0.4, rely=0.55, relheight=0.05 , relwidth=0.21) READONLY = 'readonly' self.entryEditSchool.configure(state=READONLY) self.entryEditSchool.configure(textvariable=member_support.txtEditSchoolID) self.entryEditSchool.configure(takefocus="") self.entryEditSchool.configure(cursor="ibeam") self.entryEditPhone = ttk.Entry(self.frameEditMember) self.entryEditPhone.place(relx=0.4, rely=0.64, relheight=0.05 , relwidth=0.21) READONLY = 'readonly' self.entryEditPhone.configure(state=READONLY) self.entryEditPhone.configure(textvariable=member_support.txtEditPhone) self.entryEditPhone.configure(takefocus="") self.entryEditPhone.configure(cursor="ibeam") self.TButton4 = ttk.Button(self.frameEditMember) self.TButton4.place(relx=0.28, rely=0.73, height=25, width=76) self.TButton4.configure(command=member_support.pushEditRemove) self.TButton4.configure(takefocus="") self.TButton4.configure(text='''Remove''') self.TButton5 = ttk.Button(self.frameEditMember) self.TButton5.place(relx=0.5, rely=0.73, height=25, width=76) self.TButton5.configure(command=member_support.pushEditSave) self.TButton5.configure(takefocus="") self.TButton5.configure(text='''Save''') self.TLabel9 = ttk.Label(self.frameEditMember) self.TLabel9.place(relx=0.23, rely=0.2, height=19, width=90) self.TLabel9.configure(background="#d9d9d9") self.TLabel9.configure(foreground="#000000") self.TLabel9.configure(font="TkDefaultFont") self.TLabel9.configure(relief=FLAT) self.TLabel9.configure(text='''UID / School ID :''') self.TLabel10 = ttk.Label(self.frameEditMember) self.TLabel10.place(relx=0.33, rely=0.29, height=19, width=29) self.TLabel10.configure(background="#d9d9d9") self.TLabel10.configure(foreground="#000000") self.TLabel10.configure(font="TkDefaultFont") self.TLabel10.configure(relief=FLAT) self.TLabel10.configure(text='''UID :''') self.TLabel11 = ttk.Label(self.frameEditMember) self.TLabel11.place(relx=0.31, rely=0.37, height=19, width=42) self.TLabel11.configure(background="#d9d9d9") self.TLabel11.configure(foreground="#000000") self.TLabel11.configure(font="TkDefaultFont") self.TLabel11.configure(relief=FLAT) self.TLabel11.configure(text='''Name :''') self.TLabel12 = ttk.Label(self.frameEditMember) self.TLabel12.place(relx=0.28, rely=0.46, height=19, width=57) self.TLabel12.configure(background="#d9d9d9") self.TLabel12.configure(foreground="#000000") self.TLabel12.configure(font="TkDefaultFont") self.TLabel12.configure(relief=FLAT) self.TLabel12.configure(text='''Surname :''') self.TLabel13 = ttk.Label(self.frameEditMember) self.TLabel13.place(relx=0.28, rely=0.55, height=19, width=60) self.TLabel13.configure(background="#d9d9d9") self.TLabel13.configure(foreground="#000000") self.TLabel13.configure(font="TkDefaultFont") self.TLabel13.configure(relief=FLAT) self.TLabel13.configure(text='''School ID :''') self.TLabel14 = ttk.Label(self.frameEditMember) self.TLabel14.place(relx=0.31, rely=0.64, height=19, width=44) self.TLabel14.configure(background="#d9d9d9") self.TLabel14.configure(foreground="#000000") self.TLabel14.configure(font="TkDefaultFont") self.TLabel14.configure(relief=FLAT) self.TLabel14.configure(text='''Phone :''') self.style.map('TCheckbutton',background= [('selected', _bgcolor), ('active', _ana2color)]) self.TCheckbutton1 = ttk.Checkbutton(self.frameEditMember) self.TCheckbutton1.place(relx=0.65, rely=0.2, relwidth=0.07 , relheight=0.0, height=21) self.TCheckbutton1.configure(variable=member_support.editCheck) self.TCheckbutton1.configure(command=member_support.pushEditCheck) self.TCheckbutton1.configure(takefocus="") self.TCheckbutton1.configure(text='''Edit''') self.TLabel15 = ttk.Label(self.frameEditMember) self.TLabel15.place(relx=0.25, rely=0.81, height=19, width=226) self.TLabel15.configure(background="#d9d9d9") self.TLabel15.configure(foreground="#000000") self.TLabel15.configure(font="TkDefaultFont") self.TLabel15.configure(relief=FLAT) self.TLabel15.configure(textvariable=member_support.txtLabelEditInfo) self.frameCreateEvent = Frame(top) self.frameCreateEvent.place(relx=-0.01, rely=-0.02, relheight=0 , relwidth=0) self.frameCreateEvent.configure(relief=GROOVE) self.frameCreateEvent.configure(borderwidth="2") self.frameCreateEvent.configure(relief=GROOVE) self.frameCreateEvent.configure(background="#d9d9d9") self.frameCreateEvent.configure(highlightbackground="#d9d9d9") self.frameCreateEvent.configure(highlightcolor="black") self.frameCreateEvent.configure(width=125) self.TEntry14 = ttk.Entry(self.frameCreateEvent) self.TEntry14.place(relx=0.41, rely=0.24, relheight=0.05, relwidth=0.21) self.TEntry14.configure(textvariable=member_support.txtCreateEventName) self.TEntry14.configure(takefocus="") self.TEntry14.configure(cursor="ibeam") self.TEntry15 = ttk.Entry(self.frameCreateEvent) self.TEntry15.place(relx=0.41, rely=0.33, relheight=0.05, relwidth=0.21) self.TEntry15.configure(textvariable=member_support.txtCreateSociety) self.TEntry15.configure(takefocus="") self.TEntry15.configure(cursor="ibeam") self.TEntry16 = ttk.Entry(self.frameCreateEvent) self.TEntry16.place(relx=0.41, rely=0.42, relheight=0.05, relwidth=0.21) self.TEntry16.configure(textvariable=member_support.txtCreateDate) self.TEntry16.configure(takefocus="") self.TEntry16.configure(cursor="ibeam") self.TLabel16 = ttk.Label(self.frameCreateEvent) self.TLabel16.place(relx=0.28, rely=0.24, height=19, width=74) self.TLabel16.configure(background="#d9d9d9") self.TLabel16.configure(foreground="#000000") self.TLabel16.configure(font="TkDefaultFont") self.TLabel16.configure(relief=FLAT) self.TLabel16.configure(text='''Event Name :''') self.TLabel17 = ttk.Label(self.frameCreateEvent) self.TLabel17.place(relx=0.32, rely=0.33, height=19, width=48) self.TLabel17.configure(background="#d9d9d9") self.TLabel17.configure(foreground="#000000") self.TLabel17.configure(font="TkDefaultFont") self.TLabel17.configure(relief=FLAT) self.TLabel17.configure(text='''Society :''') self.TLabel18 = ttk.Label(self.frameCreateEvent) self.TLabel18.place(relx=0.35, rely=0.42, height=19, width=34) self.TLabel18.configure(background="#d9d9d9") self.TLabel18.configure(foreground="#000000") self.TLabel18.configure(font="TkDefaultFont") self.TLabel18.configure(relief=FLAT) self.TLabel18.configure(text='''Date :''') self.TButton6 = ttk.Button(self.frameCreateEvent) self.TButton6.place(relx=0.28, rely=0.48, height=30, width=206) self.TButton6.configure(command=member_support.pushButtonCreateEvent) self.TButton6.configure(takefocus="") self.TButton6.configure(text='''Create Event''') self.TLabel19 = ttk.Label(self.frameCreateEvent) self.TLabel19.place(relx=0.3, rely=0.59, height=19, width=196) self.TLabel19.configure(background="#d9d9d9") self.TLabel19.configure(foreground="#000000") self.TLabel19.configure(font="TkDefaultFont") self.TLabel19.configure(relief=FLAT) self.TLabel19.configure(textvariable=member_support.txtLabelCreateInfo) self.frameAttendance = Frame(top) self.frameAttendance.place(relx=-0.01, rely=-0.02, relheight=0 , relwidth=0) self.frameAttendance.configure(relief=GROOVE) self.frameAttendance.configure(borderwidth="2") self.frameAttendance.configure(relief=GROOVE) self.frameAttendance.configure(background="#d9d9d9") self.frameAttendance.configure(highlightbackground="#d9d9d9") self.frameAttendance.configure(highlightcolor="black") self.frameAttendance.configure(width=125) self.TCombobox1 = ttk.Combobox(self.frameAttendance) self.TCombobox1.place(relx=0.45, rely=0.37, relheight=0.05 , relwidth=0.24) self.value_list = ["hello"] self.TCombobox1.configure(values=self.value_list) self.TCombobox1.configure(textvariable=member_support.combobox) self.TCombobox1.configure(takefocus="") self.TLabel20 = ttk.Label(self.frameAttendance) self.TLabel20.place(relx=0.3, rely=0.37, height=19, width=82) self.TLabel20.configure(background="#d9d9d9") self.TLabel20.configure(foreground="#000000") self.TLabel20.configure(font="TkDefaultFont") self.TLabel20.configure(relief=FLAT) self.TLabel20.configure(text='''Choose Event :''') self.TButton7 = ttk.Button(self.frameAttendance) self.TButton7.place(relx=0.3, rely=0.44, height=30, width=236) self.TButton7.configure(command=member_support.pushAttendanceOK) self.TButton7.configure(takefocus="") self.TButton7.configure(text='''OK''') self.frameTakeAttend = Frame(self.frameAttendance) self.frameTakeAttend.place(relx=0.23, rely=0.29, relheight=0 , relwidth=0) self.frameTakeAttend.configure(relief=GROOVE) self.frameTakeAttend.configure(borderwidth="2") self.frameTakeAttend.configure(relief=GROOVE) self.frameTakeAttend.configure(background="#d9d9d9") self.frameTakeAttend.configure(highlightbackground="#d9d9d9") self.frameTakeAttend.configure(highlightcolor="black") self.frameTakeAttend.configure(width=325) self.TEntry17 = ttk.Entry(self.frameTakeAttend) self.TEntry17.place(relx=0.37, rely=0.4, relheight=0.12, relwidth=0.42) self.TEntry17.configure(takefocus="1") self.TEntry17.configure(cursor="ibeam") self.TEntry17.configure(textvariable=member_support.txtAttendUID) self.TEntry17.bind('<Return>',lambda e:member_support.takeAttendUIDReturn(e)) self.TLabel21 = ttk.Label(self.frameTakeAttend) self.TLabel21.place(relx=0.15, rely=0.4, height=19, width=57) self.TLabel21.configure(background="#d9d9d9") self.TLabel21.configure(foreground="#000000") self.TLabel21.configure(font="TkDefaultFont") self.TLabel21.configure(relief=FLAT) self.TLabel21.configure(text='''Card UID :''') self.TLabel22 = ttk.Label(self.frameTakeAttend) self.TLabel22.place(relx=0.15, rely=0.57, height=19, width=206) self.TLabel22.configure(background="#d9d9d9") self.TLabel22.configure(foreground="#000000") self.TLabel22.configure(font="TkDefaultFont") self.TLabel22.configure(relief=FLAT) self.TLabel22.configure(textvariable=member_support.txtAttendanceInfo) self.framePassword = Frame(top) self.framePassword.place(relx=-0.01, rely=-0.02, relheight=0 , relwidth=0) self.framePassword.configure(relief=GROOVE) self.framePassword.configure(borderwidth="2") self.framePassword.configure(relief=GROOVE) self.framePassword.configure(background="#d9d9d9") self.framePassword.configure(highlightbackground="#d9d9d9") self.framePassword.configure(highlightcolor="black") self.framePassword.configure(width=603) self.TEntry18 = ttk.Entry(self.framePassword) self.TEntry18.place(relx=0.48, rely=0.31, relheight=0.05, relwidth=0.21) self.TEntry18.configure(show="*") self.TEntry18.configure(takefocus="") self.TEntry18.configure(cursor="ibeam") self.TEntry19 = ttk.Entry(self.framePassword) self.TEntry19.place(relx=0.48, rely=0.4, relheight=0.05, relwidth=0.21) self.TEntry19.configure(show="*") self.TEntry19.configure(takefocus="") self.TEntry19.configure(cursor="ibeam") self.TEntry20 = ttk.Entry(self.framePassword) self.TEntry20.place(relx=0.48, rely=0.48, relheight=0.05, relwidth=0.21) self.TEntry20.configure(show="*") self.TEntry20.configure(takefocus="") self.TEntry20.configure(cursor="ibeam") self.TButton8 = ttk.Button(self.framePassword) self.TButton8.place(relx=0.27, rely=0.55, height=30, width=256) self.TButton8.configure(command=member_support.pushSavePassword) self.TButton8.configure(takefocus="") self.TButton8.configure(text='''Save''') self.TLabel23 = ttk.Label(self.framePassword) self.TLabel23.place(relx=0.3, rely=0.31, height=19, width=103) self.TLabel23.configure(background="#d9d9d9") self.TLabel23.configure(foreground="#000000") self.TLabel23.configure(font="TkDefaultFont") self.TLabel23.configure(relief=FLAT) self.TLabel23.configure(text='''Current Password :''') self.TLabel24 = ttk.Label(self.framePassword) self.TLabel24.place(relx=0.32, rely=0.4, height=19, width=87) self.TLabel24.configure(background="#d9d9d9") self.TLabel24.configure(foreground="#000000") self.TLabel24.configure(font="TkDefaultFont") self.TLabel24.configure(relief=FLAT) self.TLabel24.configure(text='''New Password :''') self.TLabel25 = ttk.Label(self.framePassword) self.TLabel25.place(relx=0.25, rely=0.48, height=19, width=134) self.TLabel25.configure(background="#d9d9d9") self.TLabel25.configure(foreground="#000000") self.TLabel25.configure(font="TkDefaultFont") self.TLabel25.configure(relief=FLAT) self.TLabel25.configure(text='''Confirm New Password :''')
def __init__(self, master, cbcluster_config, storage_class, vct): self.master = master top = self.top = tk.Toplevel(master) self.cbcluster_config = cbcluster_config self.storage_class = storage_class if vct is None: self.vct = CBVct() self.disable_name = False else: self.vct = vct self.disable_name = True self.sizetype = ['Ki', 'Mi', 'Gi'] '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#ececec' # Closest X11 color: 'gray92' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background=[('selected', _compcolor), ('active', _ana2color)]) top.geometry("312x265+-1379+301") top.title("Volume Claim Template") top.configure(background="#d9d9d9") self.Label_Name = tk.Label(top) self.Label_Name.place(relx=0.064, rely=0.113, height=22, width=81) self.Label_Name.configure(anchor='w') self.Label_Name.configure(background="#d9d9d9") self.Label_Name.configure(foreground="#000000") self.Label_Name.configure(text='''Name''') self.TEntry_Name = ttk.Entry(top) self.TEntry_Name.place(relx=0.288, rely=0.094, relheight=0.098, relwidth=0.609) self.TEntry_Name.configure(takefocus="") self.TEntry_Name.configure(cursor="ibeam") self.TEntry_Name.insert(0, str(self.vct.name)) if self.disable_name: self.TEntry_Name['state'] = 'disabled' self.Label_Storage_Class = tk.Label(top) self.Label_Storage_Class.place(relx=0.064, rely=0.264, height=22, width=101) self.Label_Storage_Class.configure(activebackground="#f9f9f9") self.Label_Storage_Class.configure(activeforeground="black") self.Label_Storage_Class.configure(anchor='w') self.Label_Storage_Class.configure(background="#d9d9d9") self.Label_Storage_Class.configure(foreground="#000000") self.Label_Storage_Class.configure(highlightbackground="#d9d9d9") self.Label_Storage_Class.configure(highlightcolor="black") self.Label_Storage_Class.configure(text='''Storage Class''') self.sc_cbox = tk.StringVar() self.sc_cbox.set(self.vct.storage_class) self.TCombobox_SC = ttk.Combobox(top) self.TCombobox_SC.place(relx=0.417, rely=0.245, relheight=0.102, relwidth=0.468) self.TCombobox_SC.configure(textvariable=self.sc_cbox) self.TCombobox_SC.configure(takefocus="") self.TCombobox_SC.configure(values=self.storage_class) #self.TCombobox_SC.current(0) #self.menubar = tk.Menu(top,font="TkMenuFont",bg=_bgcolor,fg=_fgcolor) #top.configure(menu = self.menubar) self.Label_Size = tk.Label(top) self.Label_Size.place(relx=0.064, rely=0.415, height=22, width=41) self.Label_Size.configure(activebackground="#f9f9f9") self.Label_Size.configure(activeforeground="black") self.Label_Size.configure(anchor='w') self.Label_Size.configure(background="#d9d9d9") self.Label_Size.configure(foreground="#000000") self.Label_Size.configure(highlightbackground="#d9d9d9") self.Label_Size.configure(highlightcolor="black") self.Label_Size.configure(text='''Size''') self.TEntry_Size = ttk.Entry(top) self.TEntry_Size.place(relx=0.192, rely=0.415, relheight=0.098, relwidth=0.256) self.TEntry_Size.configure(takefocus="") self.TEntry_Size.configure(cursor="ibeam") self.TEntry_Size.insert(0, self.vct.size) self.size_cbox = tk.StringVar() self.size_cbox.set(self.vct.size_type) self.TCombobox_SizeType = ttk.Combobox(top) self.TCombobox_SizeType.place(relx=0.513, rely=0.415, relheight=0.102, relwidth=0.308) self.TCombobox_SizeType.configure(textvariable=self.size_cbox) self.TCombobox_SizeType.configure(takefocus="") self.TCombobox_SizeType.configure(values=self.sizetype) #self.size_cbox.set("Gi") self.TButton_OK = ttk.Button(top) self.TButton_OK.place(relx=0.353, rely=0.717, height=24, width=87) self.TButton_OK.configure(command=lambda: self.on_ok()) self.TButton_OK.configure(takefocus="") self.TButton_OK.configure(text='''OK''') self.TButton_Cancel = ttk.Button(top) self.TButton_Cancel.place(relx=0.673, rely=0.717, height=24, width=87) self.TButton_Cancel.configure(command=lambda: self.on_cancel()) self.TButton_Cancel.configure(takefocus="") self.TButton_Cancel.configure(text='''Cancel''')
def __init__(self, parent, controller, **kwargs): tk.Frame.__init__(self, parent, **kwargs) self.controller = controller self.current_scan_Var = tk.StringVar() self.end_scan_Var = tk.StringVar() self.scan_controls_LF = ttk.LabelFrame(self, text="Scan Initialization") self.start_scan_Button = ttk.Button(self.scan_controls_LF, text="Start", state="disabled", command=self.start_scan) self.stop_scan_Button = ttk.Button(self.scan_controls_LF, text="Stop", state="disabled", command=self.stop_scan) self.quick_scan_Button = ttk.Button(self.scan_controls_LF, text="Quick Scan", state="disabled", command=self.quick_scan) self.pause_scan_Button = ttk.Button(self.scan_controls_LF, text="Pause", state="disabled", command=self.pause_scan) self.end_scan_Text = ttk.Label(self.scan_controls_LF, ) self.end_scan_Label = ttk.Label(self.scan_controls_LF, textvariable=self.end_scan_Var) self.current_scan_Label = ttk.Label(self.scan_controls_LF, textvariable=self.current_scan_Var) self.scan_controls_LF.grid( column=0, row=0, ) self.start_scan_Button.grid(column=0, row=0, ipady=10, ipadx=10, pady=10, padx=10) self.pause_scan_Button.grid(column=1, row=0, ipady=10, ipadx=10, pady=5, padx=5) self.stop_scan_Button.grid(column=2, row=0, ipady=10, ipadx=10, pady=5, padx=5) self.quick_scan_Button.grid(column=3, row=0, ipady=10, ipadx=10, pady=10, padx=10) self.end_scan_Text.grid(column=1, row=1, padx=5, pady=5) self.end_scan_Label.grid(column=2, row=1, padx=5, pady=5) self.current_scan_Label.grid(column=3, row=1, padx=5, pady=5)
ttk.Label(model_frame, textvariable = current_model, font = 'helvetica 10 bold').grid(column = 0, row = 0, pady = 8) # Number of iterations ttk.Label(model_frame, text = "Number of iterations:").grid(column = 0, row = 1, sticky = 'nw', pady = (12, 4)) # Radio frame radio_frame = ttk.Frame(model_frame) radio_frame.grid(column = 0, row = 2, pady = 12) modes = [("20", 20, 0), ("40", 40, 1), ("60", 60, 2), ("80", 80, 3), ("100", 100, 4)] for text, number, i in modes: ttk.Radiobutton(radio_frame, text = text, variable = number_iterations, value = number).grid(column = i, row = 0) # Load models # Frame for buttons load_buttons_frame = ttk.Frame(button_frame) load_buttons_frame.grid(column = 0, row = 1, pady = 12) # Load buttons ttk.Button(load_buttons_frame, text = "Load RNN Model", command = load_rnn).grid(column = 0, row = 0, padx = 8, pady = 8) ttk.Button(load_buttons_frame, text = "Load GRU Model", command = load_gru).grid(column = 1, row = 0, padx = 8, pady = 8) ttk.Button(load_buttons_frame, text = "Load RNN Bigram", command = load_rnn_bigram).grid(column = 0, row = 1, padx = 8, pady = 8) ttk.Button(load_buttons_frame, text = "Load GRU Bigram", command = load_gru_bigram).grid(column = 1, row = 1, padx = 8, pady = 8) ttk.Button(load_buttons_frame, text = "Open Custom RNN", command = load_custom_rnn).grid(column = 0, row = 2, padx = 8, pady = 8) ttk.Button(load_buttons_frame, text = "Open Custom GRU ", command = load_custom_gru).grid(column = 1, row = 2, padx = 8, pady = 8) # Separator ttk.Separator(button_frame, orient = HORIZONTAL).grid(column = 0, row = 2, pady = 16, sticky = 'ew') # Sonnet 1 # Frame for sonnet 1 sonnet1_frame = ttk.Frame(button_frame) sonnet1_frame.grid(column = 0, row = 3) ttk.Label(sonnet1_frame, text = "Sonnet 1", font = 'helvetica 10 bold').grid(column = 0, row = 0, pady = 8) # Theme theme1_frame = ttk.Frame(sonnet1_frame)
def __init__(self): self.sawe_search = 1 self.sawe_country ='' self.sawe_state = '' self.sent = 0 self.total = 0 self.time = 0 self.timeout = 30 self.minChars = 200 self.run = False self._run = False self.cookies_file = 'cookies.json' letter = ur'letter.txt' self.table_name = 'default' self.engine = create_engine('sqlite:///database.db', echo=False) Session = sessionmaker(bind=self.engine) Session.configure(bind=self.engine) self.metadata = MetaData() self.session = Session() self.table = Table(self.table_name, self.metadata,Column('id', Integer, primary_key=True),Column('name', String), Column('fullname', String),Column('userid', String),Column('key', String)) self.metadata.create_all(self.engine) mapper(User, self.table) self.g = Grab() self.tk = Tk() self.note = ttk.Notebook(self.tk) self.tk.geometry('650x306') #self.tk.iconbitmap(default='icon.ico') self.tk.title("Spyder search engine") ### ВЕРХНЯЯ ПАНЕЛЬ ### self.Frame = Frame(self.tk, width = 460, height = 62) self.Frame.pack(side = 'top', fill = 'x') # строка статуса рассылки self.lb = ttk.Label(self.Frame, text='Welcome to the afa sender ...') self.lb.place(x = 3, y = 3) self.lb8 = ttk.Label(self.Frame, text='00:00:00', font="Arial 25 bold") self.lb8.place(x = 25, y = 20) # строка прогресс бара self.lb1 = ttk.Label(self.Frame, text='waiting ...') self.lb1.place(x = 400, y = 0, width = 250) # прогресс бар self.Bar = ttk.Progressbar(self.Frame, orient=HORIZONTAL, mode='determinate', length=250) self.Bar.place(x = 400, y = 17) # кнопка старт/стоп self.runBtn = ttk.Button(self.Frame, text = 'Start',command=self.spider_run) self.runBtn.place(x = 495, y = 38) # кнопка выход self.quitBtn = ttk.Button(self.Frame, text = 'Quit',command=self.spider_quit) self.quitBtn.place(x = 575, y = 38) # вкладки self.tab1 = Frame(self.note) self.tab3 = Frame(self.note) self.note.add(self.tab1, text = "Main") self.note.add(self.tab3, text = "Letter") self.note.pack(fill="both", expand="yes", side = 'top') # testMode = True self.mode = BooleanVar() self.modeBtn = ttk.Checkbutton(self.tab1, text="Test mode", variable=self.mode, onvalue=True, offvalue=False).place(x = 3, y = 3) # enable logging self.log = BooleanVar() #self.log.set(True) self.logBtn = ttk.Checkbutton(self.tab1, text='Enable logging',variable=self.log, onvalue=True, offvalue=False).place(x = 3, y = 23) # load_cookies self.cookies = BooleanVar() self.cookies.set(True) self.cookiesBtn = ttk.Checkbutton(self.tab1, text="load cookies",variable=self.cookies, command=self.lform, onvalue=True, offvalue=False).place(x = 3, y = 43) # fromAge lb3 = ttk.Label(self.tab1, text="Age from search").place(x = 3, y = 75) self.from_age = IntVar() self.from_age.set(18) self.from_ageBox = ttk.Combobox(self.tab1,width = 2,textvariable=self.from_age) self.from_ageBox['values'] = range(18,100) self.from_ageBox.place(x =150 , y = 75) # toAge lb4 = ttk.Label(self.tab1, text="to").place(x = 200, y = 75) self.to_age = IntVar() self.to_age.set(99) self.to_ageBox = ttk.Combobox(self.tab1,width = 2,textvariable=self.to_age) self.to_ageBox['values'] = range(18,100) self.to_ageBox.place(x =225 , y = 75) # del database self.delbaseBtn = ttk.Button(self.tab1, text = 'del database',command=self.delbase).place(x = 450, y = 175) # state self.lb7 = ttk.Label(self.tab1,text="State for search") self.state = StringVar() self.stateBox = ttk.Combobox(self.tab1,width = 25,textvariable=self.state) self.lb7.place(x = 3, y = 125) self.state.set('__all__') self.stateBox['values'] = usa_state_list self.stateBox.place(x = 153, y = 125) # country lb5 = ttk.Label(self.tab1,text="Country for search").place(x = 3, y = 100) self.country = StringVar() self.country.set('United States') self.countryBox = ttk.Combobox(self.tab1,width = 25,textvariable=self.country) self.countryBox['values'] = country_list self.countryBox.bind('<<ComboboxSelected>>', self.set_state) self.countryBox.place(x = 153, y = 100) # run search self.searchBtn = ttk.Button(self.tab1, text = 'run search',command=self.search_run) self.searchBtn.place(x = 550, y = 175) # text box txtpanelFrame = Frame(self.tab3, bg = 'white') txtpanelFrame.pack(side = 'bottom', fill = 'x') self.textbox = Text(self.tab3, font='Verdana 10', wrap='word') self.textbox.insert('1.0', 'Message header must contain the variable "$name" instead of the recipient!') scrollbar = Scrollbar(self.tab3) scrollbar['command'] = self.textbox.yview self.textbox['yscrollcommand'] = scrollbar.set self.textbox.pack(side = 'left', fill = 'both', expand = 1) scrollbar.pack(side = 'right', fill = 'y') tloadBtn = ttk.Button(txtpanelFrame, text = 'Load',command=self.load_letter) tloadBtn.pack(side = 'right') tloadBtn = ttk.Button(txtpanelFrame, text = 'Save',command=self.save_letter) tloadBtn.pack(side = 'right') tloadBtn = ttk.Button(txtpanelFrame, text = 'Apply',command=self.apply_letter) tloadBtn.pack(side = 'right') # lady id lb9 = ttk.Label(self.tab1, text='ladyId:').place(x = 450, y = 3) self.ladyId = ttk.Entry(self.tab1) #self.ladyId.insert(0,'100820') self.ladyId.place(x = 500, y = 3) ### ПАНЕЛЬ СТАТУСА ### self.lb6 = ttk.Label(self.tab1, text="Waiting for user activity ...") self.lb6.pack(side = 'bottom', fill = 'x')