def PlaceManager(self): ''' ######################################################################## Here we are trying to build the selector that will allow us to manage all plots between selected tool and save tool ultimately. This means also that the save tool will be revised. This also configures 4 labels that can be used by the user to bind method input such as coordinates and so on. For example the measuroing tool can display it's output here if requested. Or the zoom box can siplay the zoom area... etc... ######################################################################## ''' #create the Manager if self.ManagerFrame: #create the manager frame self.Manager = ttk.Frame(self.Parent, padding = '2p') ####################### #Modes and variables self.MODES = [ ("Zoom" , 0), ("Measure" , 1), ("Edit" , 2), ("Settings" , 3), ] ####################### #Grab the Path Path = os.path.join(os.path.dirname(DrawerClass.__file__),'Images') ####################### #Load images ZoomImage = PIL.Image.open(os.path.join(Path,'Zoom.jpg')) ZoomImage = ZoomImage.resize((self.ManagerIconDimension, self.ManagerIconDimension),PIL.Image.ANTIALIAS) ZoomImage = ImageTk.PhotoImage(ZoomImage) MeasImage = PIL.Image.open(os.path.join(Path,'Measure.jpg')) MeasImage = MeasImage.resize((self.ManagerIconDimension, self.ManagerIconDimension),PIL.Image.ANTIALIAS) MeasImage = ImageTk.PhotoImage(MeasImage) EditImage = PIL.Image.open(os.path.join(Path,'Edit.jpg')) EditImage = EditImage.resize((self.ManagerIconDimension, self.ManagerIconDimension),PIL.Image.ANTIALIAS) EditImage = ImageTk.PhotoImage(EditImage) SettImage = PIL.Image.open(os.path.join(Path,'Setting.jpg')) SettImage = SettImage.resize((self.ManagerIconDimension, self.ManagerIconDimension),PIL.Image.ANTIALIAS) SettImage = ImageTk.PhotoImage(SettImage) ####################### ####################### #Set the array self.PATHS = [ZoomImage, MeasImage, EditImage, SettImage] self.VARIABLE = [IntVar(), IntVar(), IntVar(), IntVar()] ####################### ####################### #Populate the frame: self.Selector = [None]*len(self.PATHS) for i in range(0,len(self.MODES)): self.Selector[i] = ttk.Checkbutton(self.Manager, #text = self.MODES[i][0], image = self.PATHS[i], variable = self.VARIABLE[i], command = partial(self.TogglerMethod,i)) #value = self.MODES[i][1]) #indicatoron = 0) self.Selector[i].config(style = 'Toolbutton' ) self.Selector[i].grid(row = 0, column = i) ####################### ####################### #initialise the labels self.ManagerLabels = [None]*4 for i in range(0, len(self.ManagerLabels)): self.ManagerLabels[i] = ttk.Label(self.Manager, text = '') self.ManagerLabels[i].grid(row = 0, column = len(self.MODES)+i ) ####################### ####################### #place the manager frame self.Manager.grid(row = len(self.ratiosX), column = 0, columnspan = len(self.ratiosY), sticky = E+W)
def __init__(self, mainwindow, material_study): tk.Toplevel.__init__(self, mainwindow) self.resizable(False, False) self.mainwindow = mainwindow self.project = self.mainwindow.projects[ self.mainwindow.currentprojectid] self.fpp = material_study.lastfpp self.main_frame = ttk.Frame(self) self.main_frame.pack(expand=True, fill='both') self.main_frame.grid_columnconfigure(0, weight=1) self.title(material_study.treetitle + ' Defect Formation Energies Plot Parameters Edition Window') # --------------------------------------------------- FPP name ------------------------------------------------- self.label0 = tk.Label(self.main_frame, text='Plot Parameters Name', pady=10) self.nameframe = tk.Frame(self.main_frame) self.nameframe.grid(row=1, column=0) namelist = [fpp.name for fpp in self.project.pp['fpp'].values()] self.fppname = ttk.Combobox(self.nameframe, values=namelist, width=40) self.fppname.set(self.fpp.name) self.fppname.bind("<<ComboboxSelected>>", self.fpp_select) self.label0.grid(row=0, column=0) self.fppname.grid(row=1, column=0) tk.Button(self.nameframe, text='Save as new parameters', command=self.fpp_create).grid(row=1, column=1) # ---------------------------------------------- FPP PARAMS ------------------------------------------------ self.label0 = tk.Label( self.main_frame, text='Formation Energy Plot Specific Parameters', font='-weight bold') self.fpp_param_frame = ttk.LabelFrame(self.main_frame, labelwidget=self.label0) self.fpp_param_frame.grid(sticky='nsew') self.display_charges_var = tk.BooleanVar( value=self.fpp.display_charges) ttk.Checkbutton(self.fpp_param_frame, text='Display Charges', variable=self.display_charges_var, onvalue=True, offvalue=False).grid(row=0, column=1, sticky=W) self.highlight_charge_change_var = tk.BooleanVar( value=self.fpp.highlight_charge_change) ttk.Checkbutton(self.fpp_param_frame, text='Highlight Charge Transition Levels', variable=self.highlight_charge_change_var, onvalue=True, offvalue=False).grid(row=1, column=1, sticky=W) self.display_gaps_legend_var = tk.BooleanVar( value=self.fpp.display_gaps_legend) ttk.Checkbutton(self.fpp_param_frame, text='Display Gap Legend', variable=self.display_gaps_legend_var, onvalue=True, offvalue=False).grid(row=2, column=1, sticky=W) # ---------------------------------------------- DISPLAY PARAMS ------------------------------------------------ self.display_param = tu.DisplayParametersFrame(self.main_frame, 'Position in the gap', 'Formation energy', self.fpp) self.display_param.frame.grid(row=3, column=0, pady=3, sticky='nsew') # ---------------------------------------------- COLORS ------------------------------------------------ self.label2 = tk.Label(self.main_frame, text='Colors', font='-weight bold') self.colors_pane = ttk.LabelFrame(self.main_frame, labelwidget=self.label2) self.colors = {} index = 0 for def_stud in material_study.ds_list: self.colors[def_stud.ID] = tk.Button( self.colors_pane, text='\t\t', bg=self.fpp.colors[def_stud.ID], command=lambda port=def_stud.ID: self.set_color(port)) self.colors[def_stud.ID].grid(row=index, column=0, sticky='w') tk.Label(self.colors_pane, text=def_stud.treetitle).grid(row=index, column=1, sticky='w') index += 1 self.colors_pane.grid(row=4, column=0, pady=3, sticky='nsew') # --------------------------------------------------- BUTTONS -------------------------------------------------- buttons_frame = ttk.Frame(self.main_frame) buttons_frame.grid(row=5, column=0, pady=3, sticky='nsew') ttk.Button(buttons_frame, text='Apply', command=self.save).grid(row=0, column=0, padx=5) ttk.Button(buttons_frame, text='OK', command=lambda: self.save(close=True)).grid(row=0, column=1, padx=5) ttk.Button(buttons_frame, text='Cancel', command=self.destroy).grid(row=0, column=2, padx=5)
def __init__(self, parent, material_study, fpp): tk.Toplevel.__init__(self, parent) self.material_study = material_study self.fpp = fpp self.main_frame = ttk.Frame(self) self.main_frame.pack(expand=True, fill='both') self.main_frame.grid_columnconfigure(0, weight=1) ttk.Label(self.main_frame, text=material_study.treetitle, font='-weight bold -size 30').grid(padx=20, pady=20) # Energy range self.e_range = tu.RangeFrame(self.main_frame, fpp.energy_range[0], fpp.energy_range[1], 'Fermi energy', 'eV', width=7) self.e_range.grid(sticky=W, padx=5, pady=5) # Transition levels highlight self.tr_levels_var = tk.BooleanVar(value=fpp.highlight_charge_change) ttk.Checkbutton(self.main_frame, text='Highlight transition levels', onvalue=True, offvalue=False, var=self.tr_levels_var).grid(sticky=W, padx=5, pady=5) # Charge display self.charge_display_var = tk.BooleanVar(value=fpp.display_charges) ttk.Checkbutton(self.main_frame, text='Show charges', onvalue=True, offvalue=False, var=self.charge_display_var).grid(sticky=W, padx=5, pady=5) # Colors self.color_choice = None ttk.Button(self.main_frame, text='Colours', command=self.open_color_choice).grid(sticky=W, padx=5, pady=5) # Gap legend display self.gap_var = tk.BooleanVar(value=fpp.display_gaps_legend) ttk.Checkbutton(self.main_frame, text='Show charges', onvalue=True, offvalue=False, var=self.gap_var).grid(sticky=W, padx=5, pady=5) # --------------------------------------------------- BUTTONS -------------------------------------------------- buttons_frame = ttk.Frame(self.main_frame) buttons_frame.grid(pady=5, padx=5) ttk.Button(buttons_frame, text='OK', command=self.validate).pack(side='left', padx=5) ttk.Button(buttons_frame, text='Cancel', command=self.destroy).pack(side='left', padx=5)
def __init__(self,*args,**kwargs): tk.Tk.__init__(self) self.versions={'gui_new':'','gui_all':'','gui_url':'https://github.com/dojafoja/FunKii-UI/releases','fnku_new':'','fnku_all':'', 'fnku_url':'https://github.com/llakssz/FunKiiU/releases'} self.download_list=[] self.selection_list=[] self.title_data=[] self.nb = ttk.Notebook(self) tab1 = ttk.Frame(self.nb) self.tab2 = ttk.Frame(self.nb) tab3 = ttk.Frame(self.nb) tab4 = ttk.Frame(self.nb) self.nb.add(tab1,text="Welcome") self.nb.add(self.tab2,text="Download") self.nb.add(tab3,text="Options") self.nb.add(tab4,text="Updates") self.nb.pack(fill="both", expand=True) self.output_dir=tk.StringVar() self.retry_count=tk.IntVar(value=3) self.patch_demo=tk.BooleanVar(value=True) self.patch_dlc=tk.BooleanVar(value=True) self.tickets_only=tk.BooleanVar(value=False) self.simulate_mode=tk.BooleanVar(value=False) self.region_usa=tk.BooleanVar(value=False) self.region_eur=tk.BooleanVar(value=False) self.region_jpn=tk.BooleanVar(value=False) self.load_title_data() self.load_program_revisions() # Tab 1 t1_frm1=ttk.Frame(tab1) t1_frm2=ttk.Frame(tab1) t1_frm3=ttk.Frame(tab1) t1_frm4=ttk.Frame(tab1) t1_frm5=ttk.Frame(tab1) t1_frm6=ttk.Frame(tab1) self.img = PhotoImage(file='logo.gif') logo=ttk.Label(t1_frm1,image=self.img).pack() lbl=ttk.Label(t1_frm2,justify='center',text='This is a simple GUI by dojafoja that was written for FunKiiU.\nCredits to cearp for writing FunKiiU and cerea1killer for rewriting\n it in way that made writing a GUI much easier.').pack() lbl=ttk.Label(t1_frm3,justify='center',text='If you plan on using an online methond to obtain keys or tickets\n then FunKiiU will need to know the name of *that key site*. If you\nhaven\'t already provided the address to the key site, you MUST do so\nbelow before proceeding. You only need to provide this information once!').pack(pady=15) lbl=ttk.Label(t1_frm4,text='Enter the name of *that key site*. Something like wiiu.thatkeysite.com').pack(pady=15,side='left') lbl=ttk.Label(t1_frm5,text='http://').pack(pady=15,side='left') self.keysite_box=ttk.Entry(t1_frm5,width=40) self.keysite_box.pack(pady=15,side='left') btn=ttk.Button(t1_frm6,text='submit',command=self.submit_key_site).pack() t1_frm1.pack() t1_frm2.pack() t1_frm3.pack() t1_frm4.pack() t1_frm5.pack() t1_frm6.pack() # Tab2 t2_frm1=ttk.Frame(self.tab2) t2_frm2=ttk.Frame(self.tab2) t2_frm3=ttk.Frame(self.tab2) t2_frm4=ttk.Frame(self.tab2) t2_frm5=ttk.Frame(self.tab2) t2_frm6=ttk.Frame(self.tab2) t2_frm7=ttk.Frame(self.tab2) t2_frm8=ttk.Frame(self.tab2) lbl=ttk.Label(t2_frm1,text='Enter as many Title ID\'s as you would like to the list. Entering a key is optional and only needed if you are NOT using\nthe online keys or online tickets method. If you are NOT using one of the online methods, then you must provide\na key for every title you add to the list or it will fail. Use the selection box to make life easier, however, it may not be a\ncomplete list of titles. You can still enter title ID and key manually. P.S. the selection box has auto-complete').pack(padx=5,pady=7) lbl=ttk.Label(t2_frm2,text='Selection:').pack(padx=5,pady=7,side='left') self.selection_box=AutocompleteCombobox(t2_frm2,values=(self.selection_list),width=65) self.selection_box.set_completion_list(self.selection_list) self.selection_box.bind('<<ComboboxSelected>>', self.selection_box_changed) self.selection_box.bind('<Return>', self.selection_box_changed) self.selection_box.pack(padx=5,pady=7,side='left') btn=ttk.Button(t2_frm2,text='refresh',width=8,command=self.populate_selection_box).pack(side='left') lbl=ttk.Label(t2_frm3,text='Title ID:').pack(padx=5,pady=7,side='left') self.id_box=ttk.Entry(t2_frm3,width=40) self.id_box.pack(padx=5,pady=5,side='left') btn=ttk.Button(t2_frm3,text='Add to list',command=self.add_to_list).pack(padx=5,pady=5,side='left') lbl=ttk.Label(t2_frm4,text='Key:').pack(padx=5,pady=7,side='left') self.key_box=ttk.Entry(t2_frm4,width=40) self.key_box.pack(padx=5,pady=5,side='left') lbl=ttk.Label(t2_frm5,text='Download list:').pack() dl_scroller=ttk.Scrollbar(t2_frm5,orient='vertical') dl_scroller.pack(side='right',fill='y') self.dl_listbox=tk.Listbox(t2_frm5,width=50,height=12) self.dl_listbox.pack(fill='y') self.dl_listbox.config(yscrollcommand=dl_scroller.set) dl_scroller.config(command=self.dl_listbox.yview) btn=ttk.Button(t2_frm6,text='Remove selected',command=self.remove_from_list).pack(padx=20,pady=10,side='left',anchor='w') btn=ttk.Button(t2_frm6,text='Clear list',command=self.clear_list).pack(padx=20,pady=10,side='left') lbl=ttk.Label(t2_frm7,text='Add an entry to the download list one at a time.\nWhen you are done, click on a download button\nbelow based on your preferred method. Don\'t\nforget to visit the options tab before you\ndownload.').pack(padx=20,pady=10) btn=ttk.Button(t2_frm8,text='Download using online tickets',width=30,command=lambda:self.download_clicked(1)).pack(padx=5,pady=10,side='left') btn=ttk.Button(t2_frm8,text='Download using online keys',width=30,command=lambda:self.download_clicked(2)).pack(padx=5,pady=10,side='left') btn=ttk.Button(t2_frm8,text='Download using entered keys',width=30,command=lambda:self.download_clicked(3)).pack(padx=5,pady=10,side='left') t2_frm1.grid(row=1,column=1,columnspan=3,sticky='w') t2_frm2.grid(row=2,column=1,columnspan=3,sticky='w') t2_frm3.grid(row=3,column=1,sticky='w') t2_frm4.grid(row=4,column=1,sticky='w') t2_frm5.grid(row=5,column=2,rowspan=3,columnspan=2,padx=5,sticky='e') t2_frm6.grid(row=8,column=3,sticky='e') t2_frm7.grid(row=5,column=1,sticky='w') t2_frm8.grid(row=9,column=1,columnspan=3) # Tab3 t3_frm1=ttk.Frame(tab3) t3_frm2=ttk.Frame(tab3) t3_frm3=ttk.Frame(tab3) t3_frm4=ttk.Frame(tab3) t3_frm5=ttk.Frame(tab3) t3_frm6=ttk.Frame(tab3) t3_frm7=ttk.Frame(tab3) t3_frm8=ttk.Frame(tab3) lbl=ttk.Label(t3_frm1,text='To use the default output directory, leave the entry blank').pack(padx=5,pady=10,side='left') lbl=ttk.Label(t3_frm2,text='Output directory').pack(padx=5,pady=5,side='left') self.out_dir_box=ttk.Entry(t3_frm2,width=35,textvariable=self.output_dir) self.out_dir_box.pack(padx=5,pady=5,side='left') btn=ttk.Button(t3_frm2,text='Browse',command=self.get_output_directory).pack(padx=5,pady=5,side='left') lbl=ttk.Label(t3_frm3,text='Retry count:').pack(padx=5,pady=5,side='left') self.retry_count_box=ttk.Combobox(t3_frm3,state='readonly',width=5,values=range(10),textvariable=self.retry_count) self.retry_count_box.set(3) self.retry_count_box.pack(padx=5,pady=5,side='left') lbl=ttk.Label(t3_frm4,text='Patch demo play limit:').pack(padx=5,pady=5,side='left') self.patch_demo_true=ttk.Radiobutton(t3_frm4,text='Yes',variable=self.patch_demo,value=True) self.patch_demo_false=ttk.Radiobutton(t3_frm4,text='No',variable=self.patch_demo,value=False) self.patch_demo_true.pack(padx=5,pady=5,side='left') self.patch_demo_false.pack(padx=5,pady=5,side='left') lbl=ttk.Label(t3_frm5,text='Patch DLC:').pack(padx=5,pady=5,side='left') self.patch_dlc_true=ttk.Radiobutton(t3_frm5,text='Yes',variable=self.patch_dlc,value=True) self.patch_dlc_false=ttk.Radiobutton(t3_frm5,text='No',variable=self.patch_dlc,value=False) self.patch_dlc_true.pack(padx=5,pady=5,side='left') self.patch_dlc_false.pack(padx=5,pady=5,side='left') lbl=ttk.Label(t3_frm6,text='Tickets only mode:').pack(padx=5,pady=5,side='left') self.tickets_only_true=ttk.Radiobutton(t3_frm6,text='On',variable=self.tickets_only,value=True) self.tickets_only_false=ttk.Radiobutton(t3_frm6,text='Off',variable=self.tickets_only,value=False) self.tickets_only_true.pack(padx=5,pady=5,side='left') self.tickets_only_false.pack(padx=5,pady=5,side='left') lbl=ttk.Label(t3_frm7,text='Simulation mode:').pack(padx=5,pady=5,side='left') self.simulate_mode_true=ttk.Radiobutton(t3_frm7,text='On',variable=self.simulate_mode,value=True) self.simulate_mode_false=ttk.Radiobutton(t3_frm7,text='Off',variable=self.simulate_mode,value=False) self.simulate_mode_true.pack(padx=5,pady=5,side='left') self.simulate_mode_false.pack(padx=5,pady=5,side='left') lbl=ttk.Label(t3_frm8,text='Download ALL titles on NUS except system\ntitles. Choose the regions you would like:').pack(padx=5,pady=5,side='left') self.region_box_usa=ttk.Checkbutton(t3_frm8,text='USA',variable=self.region_usa).pack(padx=5,pady=5,side='left') self.region_box_eur=ttk.Checkbutton(t3_frm8,text='EUR',variable=self.region_eur).pack(padx=5,pady=5,side='left') self.region_box_jpn=ttk.Checkbutton(t3_frm8,text='JPN',variable=self.region_jpn).pack(padx=5,pady=5,side='left') btn=ttk.Button(t3_frm8,text='Go',width=4,command=lambda:self.download_clicked(4)).pack(pady=20,side='left') t3_frm1.grid(row=1,column=1,sticky='w') t3_frm2.grid(row=2,column=1,sticky='w') t3_frm3.grid(row=3,column=1,sticky='w') t3_frm4.grid(row=4,column=1,sticky='w') t3_frm5.grid(row=5,column=1,sticky='w') t3_frm6.grid(row=6,column=1,sticky='w') t3_frm7.grid(row=7,column=1,sticky='w') t3_frm8.grid(row=8,column=1,padx=10,pady=70,sticky='w') # Tab 4 t4_frm0=ttk.Frame(tab4) t4_frm1=ttk.Frame(tab4) t4_frm2=ttk.Frame(tab4) t4_frm3=ttk.Frame(tab4) t4_frm4=ttk.Frame(tab4) t4_frm5=ttk.Frame(tab4) t4_frm6=ttk.Frame(tab4) t4_frm7=ttk.Frame(tab4) t4_frm8=ttk.Frame(tab4) t4_frm9=ttk.Frame(tab4) t4_frm10=ttk.Frame(tab4) t4_frm11=ttk.Frame(tab4) lbl=ttk.Label(t4_frm0,text='Version Information:\n\nSince the FunKii-UI GUI and FunKiiU are two seperate applications developed by different authors,\nswitching versions can break compatibility and shouldn\'t be done if you don\'t know what you are\ndoing. I will try to implement a compatibility list in a future release').pack(padx=5,pady=1,side='left') lbl=ttk.Label(t4_frm1,text='GUI application:',font="Helvetica 13 bold").pack(padx=5,pady=5,side='left') lbl=ttk.Label(t4_frm2,text='Running version:\nTargeted for:').pack(padx=5,pady=1,side='left') lbl=ttk.Label(t4_frm2,text=__VERSION__+'\n'+targetversion).pack(padx=5,pady=1,side='left') lbl=ttk.Label(t4_frm3,text='Latest release:').pack(padx=5,pady=5,side='left') lbl=ttk.Label(t4_frm3,text=self.versions['gui_new']).pack(padx=5,pady=1,side='left') lbl=ttk.Label(t4_frm4,text='Update to latest release:').pack(padx=5,pady=1,side='left') btn=ttk.Button(t4_frm4,text='Update',command=lambda:self.update_application('gui',self.versions['gui_new'])).pack(padx=5,pady=1,side='left') lbl=ttk.Label(t4_frm5,text='Switch to different version:').pack(padx=5,pady=1,side='left') self.gui_switchv_box=ttk.Combobox(t4_frm5,width=7,values=[x for x in self.versions['gui_all']],state='readonly') self.gui_switchv_box.pack(padx=5,pady=1,side='left') btn=ttk.Button(t4_frm5,text='Switch',command=lambda:self.update_application('gui',self.gui_switchv_box.get())).pack(padx=5,pady=1,side='left') lbl=ttk.Label(t4_frm6,text='').pack(pady=15,side='left') lbl=ttk.Label(t4_frm7,text='FunKiiU core application:',font="Helvetica 13 bold").pack(padx=5,pady=5,side='left') lbl=ttk.Label(t4_frm8,text='running version:').pack(padx=5,pady=1,side='left') lbl=ttk.Label(t4_frm8,text=fnku.__VERSION__).pack(padx=5,pady=1,side='left') lbl=ttk.Label(t4_frm9,text='latest release:').pack(padx=5,pady=1,side='left') lbl=ttk.Label(t4_frm9,text=self.versions['fnku_new']).pack(padx=5,pady=1,side='left') lbl=ttk.Label(t4_frm10,text='Update to latest release:').pack(padx=5,pady=1,side='left') btn=ttk.Button(t4_frm10,text='Update',command=lambda:self.update_application('fnku',self.versions['fnku_new'])).pack(padx=5,pady=1,side='left') lbl=ttk.Label(t4_frm11,text='Switch to different version:').pack(padx=5,pady=1,side='left') self.fnku_switchv_box=ttk.Combobox(t4_frm11,width=7,values=[x for x in self.versions['fnku_all']],state='readonly') self.fnku_switchv_box.pack(padx=5,pady=1,side='left') btn=ttk.Button(t4_frm11,text='Switch',command=lambda:self.update_application('fnku',self.fnku_switchv_box.get())).pack(padx=5,pady=1,side='left') t4_frm0.grid(row=0,column=1,padx=5,pady=5,sticky='w') t4_frm1.grid(row=1,column=1,padx=5,sticky='w') t4_frm2.grid(row=2,column=1,padx=25,sticky='w') t4_frm3.grid(row=3,column=1,padx=25,sticky='w') t4_frm4.grid(row=4,column=1,padx=25,sticky='w') t4_frm5.grid(row=5,column=1,padx=25,sticky='w') t4_frm6.grid(row=6,column=1,padx=5,sticky='w') t4_frm7.grid(row=7,column=1,padx=5,sticky='w') t4_frm8.grid(row=8,column=1,padx=25,sticky='w') t4_frm9.grid(row=9,column=1,padx=25,sticky='w') t4_frm10.grid(row=10,column=1,padx=25,sticky='w') t4_frm11.grid(row=11,column=1,padx=25,sticky='w')
def show_settings_frequency(self, frequencySettings=None, specificSettings=None): if self.settings_sreen == None: self.create_settings_screen(VisualisationTypes.FREQUENCY, 300, 220) titleChannels = tk.Label(self.settings_sreen, text="Displayed channels:") titleChannels.pack(anchor=NW, padx=20, pady=10) frame1 = tk.Frame(self.settings_sreen) frame1.pack(side="top", fill="x", padx=20) checkLeft = ttk.Checkbutton( self.settings_sreen, text=ChannelTypes.LEFT, variable=frequencySettings.channel[ChannelTypes.LEFT]) checkLeft.pack(in_=frame1, side=LEFT) checkRight = ttk.Checkbutton( self.settings_sreen, text=ChannelTypes.RIGHT, variable=frequencySettings.channel[ChannelTypes.RIGHT]) checkRight.pack(in_=frame1, side=LEFT, padx=37) frame2 = ttk.Frame(self.settings_sreen) frame2.pack(side="top", fill="x", padx=20) checkFront = ttk.Checkbutton( self.settings_sreen, text=ChannelTypes.MID, variable=frequencySettings.channel[ChannelTypes.MID]) checkFront.pack(in_=frame2, side=LEFT) checkBack = ttk.Checkbutton( self.settings_sreen, text=ChannelTypes.BACK, variable=frequencySettings.channel[ChannelTypes.BACK]) checkBack.pack(in_=frame2, side=LEFT, padx=20) titleLabels = tk.Label(self.settings_sreen, text="Display settings:") titleLabels.pack(anchor=NW, padx=20, pady=10) frame3 = ttk.Frame(self.settings_sreen) frame3.pack(side="top", fill="x", padx=20) checkLabels = ttk.Checkbutton( self.settings_sreen, text='Show labels on plot', variable=frequencySettings.showLabels) checkLabels.pack(in_=frame3, side=LEFT) buttonFrame = ttk.Frame(self.settings_sreen) buttonFrame.pack(anchor=SE, fill="x", padx=20, pady=20) button = ttk.Button(self.settings_sreen, text="Cancel", command=self.remove_settings_screen) button.pack(in_=buttonFrame, side=RIGHT) button = ttk.Button(self.settings_sreen, text="Ok", command=partial(self.save_settings_screen, frequencySettings)) button.pack(in_=buttonFrame, side=RIGHT, padx=10) else: if self.settings_sreen.type == VisualisationTypes.FREQUENCY: self.settings_sreen.focus() else: self.remove_settings_screen() self.show_settings_frequency(frequencySettings)
p3l1b.grid(row=3, column=0, columnspan=6) p3l3 = ttk.Label(page3, text=" Model form: ") p3l3.grid(row=4, column=0, sticky="E") modelforms = ["logit ", "probit"] p3om1=ttk.OptionMenu(page3, modelval, modelforms[0], *modelforms, \ command=outmodel) p3om1.grid(row=4, column=1) p3l4 = ttk.Label(page3, text=" design: ") p3l4.grid(row=4, column=2, sticky="E") ourdesigns=["c optimal ",\ "sigma optimal",\ "d optimal "] p3om2=ttk.OptionMenu(page3, designval, ourdesigns[0], *ourdesigns, \ command=outdesign) p3om2.grid(row=4, column=3, columnspan=2, sticky="W") p3bcb=ttk.Checkbutton(page3, text=" use bias reduction", \ variable=ibias, command=resuggest) p3bcb.grid(row=4, column=5) p3l6 = ttk.Label(page3, text=" ") p3l6.grid(row=6, column=0, columnspan=6) p3l7 = ttk.Label(page3, text=" ") p3l7.grid(row=7, column=0, columnspan=6) p3l8 = ttk.Label( page3, text="Suggestion for next stimulus (depends on design parameters)") p3l8.grid(row=8, column=0, columnspan=6) p3l9 = ttk.Label(page3, text=" ") p3l9.grid(row=9, column=0, columnspan=6) p3l10 = ttk.Label(page3, text=" Suggested stimulus: ") p3l10.grid(row=10, column=0) stimval.set("") p3e1 = ttk.Entry(page3, width=10, textvariable=stimval)
def __init__(self, parent, title, app, **kw): kw = self.initKw(kw) MfxDialog.__init__(self, parent, title, kw.resizable, kw.default) top_frame, bottom_frame = self.createFrames(kw) self.createBitmaps(top_frame, kw) frame = ttk.Frame(top_frame) frame.pack(expand=True, fill='both', padx=10, pady=10) frame.columnconfigure(0, weight=1) notebook = ttk.Notebook(frame) notebook.pack(expand=True, fill='both') for w in WizardWidgets: if isinstance(w, basestring): frame = ttk.Frame(notebook) notebook.add(frame, text=w, sticky='nsew', padding=5) frame.columnconfigure(1, weight=1) row = 0 continue ttk.Label(frame, text=w.label).grid(row=row, column=0) if w.widget == 'preset': if w.variable is None: w.variable = Tkinter.StringVar() values = [_(v) for v in w.values] default = _(w.default) values.remove(default) values.sort() values.insert(0, default) def callback(e, w=w): self.presetSelected(e, w) cb = PysolCombo(frame, values=tuple(values), textvariable=w.variable, exportselection=False, selectcommand=callback, state='readonly', width=32) cb.grid(row=row, column=1, sticky='ew', padx=2, pady=2) elif w.widget == 'entry': if w.variable is None: w.variable = Tkinter.StringVar() en = ttk.Entry(frame, textvariable=w.variable) en.grid(row=row, column=1, sticky='ew', padx=2, pady=2) elif w.widget == 'menu': if w.variable is None: w.variable = Tkinter.StringVar() values = [_(v) for v in w.values] cb = PysolCombo(frame, values=tuple(values), textvariable=w.variable, exportselection=False, state='readonly', width=32) cb.grid(row=row, column=1, sticky='ew', padx=2, pady=2) elif w.widget == 'spin': if w.variable is None: w.variable = Tkinter.IntVar() else: # delete all trace callbacks for mod, cbname in w.variable.trace_vinfo(): w.variable.trace_vdelete(mod, cbname) from_, to = w.values # s = Spinbox( # frame, textvariable=w.variable, from_=from_, to=to) s = PysolScale(frame, from_=from_, to=to, resolution=1, orient='horizontal', variable=w.variable) s.grid(row=row, column=1, sticky='ew', padx=2, pady=2) elif w.widget == 'check': if w.variable is None: w.variable = Tkinter.BooleanVar() ch = ttk.Checkbutton(frame, variable=w.variable, takefocus=False) ch.grid(row=row, column=1, sticky='ew', padx=2, pady=2) if w.current_value is None: v = w.default else: v = w.current_value if w.widget in ('menu', 'preset'): v = _(v) w.variable.set(v) row += 1 focus = self.createButtons(bottom_frame, kw) self.mainloop(focus, kw.timeout)
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' 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("600x449+552+80") top.title("New Toplevel") top.configure(background="#d9d9d9") self.TButton1 = ttk.Button(top) self.TButton1.place(relx=0.7, rely=0.223, height=35, width=166) self.TButton1.configure(takefocus="") self.TButton1.configure(text='''Add to database''') self.TButton1.configure(width=166) self.style.map('TCheckbutton', background=[('selected', _bgcolor), ('active', _ana2color)]) self.TCheckbutton1 = ttk.Checkbutton(top) self.TCheckbutton1.place(relx=0.617, rely=0.089, relwidth=0.117, relheight=0.0, height=21) self.TCheckbutton1.configure(variable=unknown_support.tch45) self.TCheckbutton1.configure(takefocus="") self.TCheckbutton1.configure(text='''Watched''') self.To_watch = ttk.Checkbutton(top) self.To_watch.place(relx=0.45, rely=0.089, relwidth=0.12, relheight=0.0, height=21) self.To_watch.configure(variable=unknown_support.tch46) self.To_watch.configure(takefocus="") self.To_watch.configure(text='''To watch''') self.menubar = tk.Menu(top, font="TkMenuFont", bg=_bgcolor, fg=_fgcolor) top.configure(menu=self.menubar) self.TButton1_1 = ttk.Button(top) self.TButton1_1.place(relx=0.05, rely=0.223, height=35, width=136) self.TButton1_1.configure(takefocus="") self.TButton1_1.configure(text='''Add Description''') self.TButton1_1.configure(width=136) self.TButton1_2 = ttk.Button(top) self.TButton1_2.place(relx=0.567, rely=0.223, height=35, width=56) self.TButton1_2.configure(takefocus="") self.TButton1_2.configure(text='''Clear''') self.TButton1_2.configure(width=56) self.Text1 = tk.Text(top) self.Text1.place(relx=0.05, rely=0.067, relheight=0.076, relwidth=0.34) self.Text1.configure(background="white") self.Text1.configure(font="TkTextFont") self.Text1.configure(foreground="black") self.Text1.configure(highlightbackground="#d9d9d9") self.Text1.configure(highlightcolor="black") self.Text1.configure(insertbackground="black") self.Text1.configure(selectbackground="#c4c4c4") self.Text1.configure(selectforeground="black") self.Text1.configure(width=204) self.Text1.configure(wrap="word") tooltip_font = "TkDefaultFont" ToolTip(self.Text1, tooltip_font, '''Input here...''', delay=0.5) self.TLabel1 = ttk.Label(top) self.TLabel1.place(relx=0.167, rely=0.022, height=19, width=70) self.TLabel1.configure(background="#d9d9d9") self.TLabel1.configure(foreground="#000000") self.TLabel1.configure(font="TkDefaultFont") self.TLabel1.configure(relief="flat") self.TLabel1.configure(text='''Movie name''') self.TButton1_2 = ttk.Button(top) self.TButton1_2.place(relx=0.3, rely=0.223, height=35, width=136) self.TButton1_2.configure(takefocus="") self.TButton1_2.configure(text='''Attach a poster''') self.style.configure('TNotebook.Tab', background=_bgcolor) self.style.configure('TNotebook.Tab', foreground=_fgcolor) self.style.map('TNotebook.Tab', background=[('selected', _compcolor), ('active', _ana2color)]) self.TNotebook1 = ttk.Notebook(top) self.TNotebook1.place(relx=0.033, rely=0.334, relheight=0.592, relwidth=0.957) self.TNotebook1.configure(width=574) self.TNotebook1.configure(takefocus="") self.TNotebook1_t0 = tk.Frame(self.TNotebook1) self.TNotebook1.add(self.TNotebook1_t0, padding=3) self.TNotebook1.tab( 0, text="Overview", compound="left", underline="-1", ) self.TNotebook1_t0.configure(background="#d9d9d9") self.TNotebook1_t0.configure(highlightbackground="#d9d9d9") self.TNotebook1_t0.configure(highlightcolor="black") self.TNotebook1_t1 = tk.Frame(self.TNotebook1) self.TNotebook1.add(self.TNotebook1_t1, padding=3) self.TNotebook1.tab( 1, text="Detailed description", compound="left", underline="-1", ) self.TNotebook1_t1.configure(background="#d9d9d9") self.TNotebook1_t1.configure(highlightbackground="#d9d9d9") self.TNotebook1_t1.configure(highlightcolor="black") self.Spinbox1 = tk.Spinbox(top, from_=1.0, to=10.0) self.Spinbox1.place(relx=0.8, rely=0.089, relheight=0.042, relwidth=0.058) self.Spinbox1.configure(activebackground="#f9f9f9") self.Spinbox1.configure(background="white") self.Spinbox1.configure(buttonbackground="#d9d9d9") self.Spinbox1.configure(disabledforeground="#a3a3a3") self.Spinbox1.configure(foreground="black") self.Spinbox1.configure(highlightbackground="black") self.Spinbox1.configure(highlightcolor="black") self.Spinbox1.configure(increment="0.5") self.Spinbox1.configure(insertbackground="black") self.Spinbox1.configure(selectbackground="#c4c4c4") self.Spinbox1.configure(selectforeground="black") self.Spinbox1.configure(textvariable=unknown_support.spinbox) self.Spinbox1.configure(width=35)
def __init__(self, parent, controller): ttk.Frame.__init__(self, parent) self['padding'] = 4 self.parent = parent self.controller = controller self.datalist = list(range(1,11)) self.terminatorlist = ['\\n', ';', '\\n;'] self.numgraphslist = list(range(1,4)) #How long is the data coming in? datalabel = ttk.Label(self, text='Variables per line') databox = ttk.Combobox(self, width=8, values = self.datalist, \ textvariable=self.controller.TKvariables['datalength']) CreateToolTip(datalabel,\ "The numbder of variables per line. " "A line is a series of variables seperated by a comma, and terminated by a \\n character. " "For example, the line: data1, data2, data3\\n would have 3 variables. " "All data recieved must be a string, no binary numbers allowed") maxlabel = ttk.Label(self, text='Max Message Length') maxbox = ttk.Entry(self, width=11, \ textvariable=self.controller.TKvariables['maxlength']) CreateToolTip(maxlabel, \ 'The maximum length of one line (in characters). If anything ' 'be conservative with this number, err on the high side. The program reads ' 'lines from the serial buffer until it is below this number of characters, to avoid ' 'a condition where it tries to read a line out of the serial buffer and a \\n ' "can't be found" ) numgraphslabel = ttk.Label(self, text='Number of graphs') numgraphsbox = ttk.Combobox(self, width=8, values=self.numgraphslist, \ textvariable=self.controller.TKvariables['numgraphs']) numgraphsbox.bind('<<ComboboxSelected>>', self.parent.updateGraphs) CreateToolTip(numgraphslabel,\ "The number of graphs to plot data on") maxcheck = ttk.Checkbutton(self, text='Start Maximized?', \ variable=self.controller.TKvariables['startmax'], \ onvalue='yes', offvalue='no') CreateToolTip(maxcheck, \ "When the graph is started, the window will be maximized.") log2filecheck = ttk.Checkbutton(self, text='Log to file?',\ variable=self.controller.TKvariables['log2file'], onvalue='on', \ offvalue='off', command=self.controller.getfilename) CreateToolTip(log2filecheck, \ "If checked, all data recieved will also be logged to a CSV file") AObutton = ttk.Button(self, text='Advanced Options', command=self.AObutton) datalabel.grid(row=1, column = 1, sticky='w') databox.grid(row=1, column = 2, sticky='w', padx=7) maxlabel.grid(row=2, column=1, sticky='w') maxbox.grid(row=2, column=2, sticky='w', padx=7) numgraphslabel.grid(row=3, column=1, sticky='w') numgraphsbox.grid(row=3, column=2, sticky='w', padx=7) maxcheck.grid(row=4, column=1, columnspan=2, sticky='w') log2filecheck.grid(row=5, column=1, columnspan=2, sticky='w') AObutton.grid(row=6, column=1, columnspan=2, sticky='ew')
def __init__(self, top=None): _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' font10 = "-family {Segoe Script} -size 12 -weight normal " \ "-slant italic -underline 0 -overstrike 0" font11 = "-family {Rockwell Extra Bold} -size 12 -weight bold " \ "-slant roman -underline 0 -overstrike 0" font12 = "-family {Sakkal Majalla} -size 17 -weight bold " \ "-slant roman -underline 0 -overstrike 0" font13 = "-family {Segoe UI Semibold} -size 14 -weight bold " \ "-slant roman -underline 0 -overstrike 0" font14 = "-family {Bookman Old Style} -size 17 -weight bold " \ "-slant roman -underline 0 -overstrike 0" font15 = "-family {Segoe UI Semibold} -size 12 -weight bold " \ "-slant roman -underline 0 -overstrike 0" font9 = "-family {Britannic Bold} -size 48 -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("1538x878+-109+36") top.title("New Toplevel") top.configure(background="#ffff24") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") self.Label1 = tk.Label(top) self.Label1.place(relx=0.013, rely=0.023, height=81, width=156) self.Label1.configure(activebackground="#f9f9f9") self.Label1.configure(activeforeground="black") self.Label1.configure(background="#ffff24") self.Label1.configure(disabledforeground="#a3a3a3") self.Label1.configure(font=font9) self.Label1.configure(foreground="#ff250d") self.Label1.configure(highlightbackground="#d9d9d9") self.Label1.configure(highlightcolor="black") self.Label1.configure(text='''eTAX''') self.menubar = tk.Menu(top, font="TkMenuFont", bg=_bgcolor, fg=_fgcolor) top.configure(menu=self.menubar) self.Label2 = tk.Label(top) self.Label2.place(relx=0.072, rely=0.103, height=31, width=141) self.Label2.configure(activebackground="#f9f9f9") self.Label2.configure(activeforeground="black") self.Label2.configure(background="#ffff24") self.Label2.configure(disabledforeground="#a3a3a3") self.Label2.configure(font=font10) self.Label2.configure(foreground="#13c12a") self.Label2.configure(highlightbackground="#d9d9d9") self.Label2.configure(highlightcolor="black") self.Label2.configure(text='''working for you''') self.backbutton = tk.Button(top) self.backbutton.place(relx=0.033, rely=0.194, height=44, width=97) self.backbutton.configure(activebackground="#ececec") self.backbutton.configure(activeforeground="#000000") self.backbutton.configure(background="#120bd8") self.backbutton.configure(disabledforeground="#a3a3a3") self.backbutton.configure(font=font11) self.backbutton.configure(foreground="#fcffff") self.backbutton.configure(highlightbackground="#d9d9d9") self.backbutton.configure(highlightcolor="black") self.backbutton.configure(pady="0") self.backbutton.configure(text='''Back''') self.exit = tk.Button(top) self.exit.place(relx=0.033, rely=0.285, height=44, width=97) self.exit.configure(activebackground="#ececec") self.exit.configure(activeforeground="#000000") self.exit.configure(background="#120bd8") self.exit.configure(disabledforeground="#a3a3a3") self.exit.configure(font=font11) self.exit.configure(foreground="#fcffff") self.exit.configure(highlightbackground="#d9d9d9") self.exit.configure(highlightcolor="black") self.exit.configure(pady="0") self.exit.configure(command=self.exits, text='''Exit''') self.Label3 = tk.Label(top) self.Label3.place(relx=0.013, rely=0.9, height=21, width=56) self.Label3.configure(activebackground="#f9f9f9") self.Label3.configure(activeforeground="black") self.Label3.configure(background="#ffff24") self.Label3.configure(disabledforeground="#a3a3a3") self.Label3.configure(foreground="#000000") self.Label3.configure(highlightbackground="#d9d9d9") self.Label3.configure(highlightcolor="black") self.Label3.configure(text='''etax-2019''') self.Label3_3 = tk.Label(top) self.Label3_3.place(relx=0.013, rely=0.923, height=21, width=34) self.Label3_3.configure(activebackground="#f9f9f9") self.Label3_3.configure(activeforeground="black") self.Label3_3.configure(background="#ffff24") self.Label3_3.configure(disabledforeground="#a3a3a3") self.Label3_3.configure(foreground="#000000") self.Label3_3.configure(highlightbackground="#d9d9d9") self.Label3_3.configure(highlightcolor="black") self.Label3_3.configure(text='''v 1.0.2''') self.Label3_4 = tk.Label(top) self.Label3_4.place(relx=0.007, rely=0.968, height=21, width=134) self.Label3_4.configure(activebackground="#f9f9f9") self.Label3_4.configure(activeforeground="black") self.Label3_4.configure(background="#ffff24") self.Label3_4.configure(disabledforeground="#a3a3a3") self.Label3_4.configure(foreground="#000000") self.Label3_4.configure(highlightbackground="#d9d9d9") self.Label3_4.configure(highlightcolor="black") self.Label3_4.configure(text='''Working On Windows''') self.Label3_1 = tk.Label(top) self.Label3_1.place(relx=0.013, rely=0.945, height=21, width=164) self.Label3_1.configure(activebackground="#f9f9f9") self.Label3_1.configure(activeforeground="black") self.Label3_1.configure(background="#ffff24") self.Label3_1.configure(disabledforeground="#a3a3a3") self.Label3_1.configure(foreground="#000000") self.Label3_1.configure(highlightbackground="#d9d9d9") self.Label3_1.configure(highlightcolor="black") self.Label3_1.configure(text='''Connected to MySQL server 8.0''') self.Frame1 = tk.Frame(top) self.Frame1.place(relx=0.293, rely=0.216, relheight=0.655, relwidth=0.452) self.Frame1.configure(relief='groove') self.Frame1.configure(borderwidth="2") self.Frame1.configure(relief='groove') self.Frame1.configure(background="#68ff3b") self.Frame1.configure(width=695) self.txtward = tk.Entry(self.Frame1) self.txtward.place(relx=0.504, rely=0.243, height=30, relwidth=0.437) self.txtward.configure(background="white") self.txtward.configure(disabledforeground="#a3a3a3") self.txtward.configure(font="TkFixedFont") self.txtward.configure(foreground="#000000") self.txtward.configure(insertbackground="black") self.txtward.configure(width=304) self.txtname = tk.Entry(self.Frame1) self.txtname.place(relx=0.504, rely=0.157, height=30, relwidth=0.437) self.txtname.configure(background="white") self.txtname.configure(disabledforeground="#a3a3a3") self.txtname.configure(font="TkFixedFont") self.txtname.configure(foreground="#000000") self.txtname.configure(insertbackground="black") self.txtname.configure(width=304) self.txtmeter = tk.Entry(self.Frame1) self.txtmeter.place(relx=0.504, rely=0.33, height=30, relwidth=0.437) self.txtmeter.configure(background="white") self.txtmeter.configure(disabledforeground="#a3a3a3") self.txtmeter.configure(font="TkFixedFont") self.txtmeter.configure(foreground="#000000") self.txtmeter.configure(insertbackground="black") self.txtmeter.configure(width=304) self.Label5 = tk.Label(self.Frame1) self.Label5.place(relx=0.23, rely=0.07, height=37, width=107) self.Label5.configure(background="#68ff3b") self.Label5.configure(disabledforeground="#a3a3a3") self.Label5.configure(font=font12) self.Label5.configure(foreground="#4124b5") self.Label5.configure(text='''UID Number :''') self.Label5.configure(width=107) self.Label5_2 = tk.Label(self.Frame1) self.Label5_2.place(relx=0.216, rely=0.313, height=47, width=127) self.Label5_2.configure(activebackground="#f9f9f9") self.Label5_2.configure(activeforeground="black") self.Label5_2.configure(background="#68ff3b") self.Label5_2.configure(disabledforeground="#a3a3a3") self.Label5_2.configure(font=font12) self.Label5_2.configure(foreground="#4124b5") self.Label5_2.configure(highlightbackground="#d9d9d9") self.Label5_2.configure(highlightcolor="black") self.Label5_2.configure(text='''Meter Number :''') self.Label5_2.configure(width=127) self.Label5_3 = tk.Label(self.Frame1) self.Label5_3.place(relx=0.23, rely=0.243, height=37, width=117) self.Label5_3.configure(activebackground="#f9f9f9") self.Label5_3.configure(activeforeground="black") self.Label5_3.configure(background="#68ff3b") self.Label5_3.configure(disabledforeground="#a3a3a3") self.Label5_3.configure(font=font12) self.Label5_3.configure(foreground="#4124b5") self.Label5_3.configure(highlightbackground="#d9d9d9") self.Label5_3.configure(highlightcolor="black") self.Label5_3.configure(text='''Ward Number :''') self.Label5_3.configure(width=117) self.Label5_4 = tk.Label(self.Frame1) self.Label5_4.place(relx=0.245, rely=0.417, height=37, width=97) self.Label5_4.configure(activebackground="#f9f9f9") self.Label5_4.configure(activeforeground="black") self.Label5_4.configure(background="#68ff3b") self.Label5_4.configure(disabledforeground="#a3a3a3") self.Label5_4.configure(font=font12) self.Label5_4.configure(foreground="#4124b5") self.Label5_4.configure(highlightbackground="#d9d9d9") self.Label5_4.configure(highlightcolor="black") self.Label5_4.configure(text='''Housetax :''') self.Label5_4.configure(width=97) self.Label5_5 = tk.Label(self.Frame1) self.Label5_5.place(relx=0.23, rely=0.157, height=37, width=107) self.Label5_5.configure(activebackground="#f9f9f9") self.Label5_5.configure(activeforeground="black") self.Label5_5.configure(background="#68ff3b") self.Label5_5.configure(disabledforeground="#a3a3a3") self.Label5_5.configure(font=font12) self.Label5_5.configure(foreground="#4124b5") self.Label5_5.configure(highlightbackground="#d9d9d9") self.Label5_5.configure(highlightcolor="black") self.Label5_5.configure(text='''Name :''') self.Label5_5.configure(width=107) self.Label5_6 = tk.Label(self.Frame1) self.Label5_6.place(relx=0.23, rely=0.504, height=37, width=107) self.Label5_6.configure(activebackground="#f9f9f9") self.Label5_6.configure(activeforeground="black") self.Label5_6.configure(background="#68ff3b") self.Label5_6.configure(disabledforeground="#a3a3a3") self.Label5_6.configure(font=font12) self.Label5_6.configure(foreground="#4124b5") self.Label5_6.configure(highlightbackground="#d9d9d9") self.Label5_6.configure(highlightcolor="black") self.Label5_6.configure(text='''Healthtax :''') self.Label5_6.configure(width=107) self.Label5_7 = tk.Label(self.Frame1) self.Label5_7.place(relx=0.23, rely=0.574, height=47, width=107) self.Label5_7.configure(activebackground="#f9f9f9") self.Label5_7.configure(activeforeground="black") self.Label5_7.configure(background="#68ff3b") self.Label5_7.configure(disabledforeground="#a3a3a3") self.Label5_7.configure(font=font12) self.Label5_7.configure(foreground="#4124b5") self.Label5_7.configure(highlightbackground="#d9d9d9") self.Label5_7.configure(highlightcolor="black") self.Label5_7.configure(text='''Lighttax :''') self.Label5_7.configure(width=107) self.Label5_8 = tk.Label(self.Frame1) self.Label5_8.place(relx=0.23, rely=0.661, height=47, width=107) self.Label5_8.configure(activebackground="#f9f9f9") self.Label5_8.configure(activeforeground="black") self.Label5_8.configure(background="#68ff3b") self.Label5_8.configure(disabledforeground="#a3a3a3") self.Label5_8.configure(font=font12) self.Label5_8.configure(foreground="#4124b5") self.Label5_8.configure(highlightbackground="#d9d9d9") self.Label5_8.configure(highlightcolor="black") self.Label5_8.configure(text='''Watertax :''') self.Label5_8.configure(width=107) self.Label5_9 = tk.Label(self.Frame1) self.Label5_9.place(relx=0.23, rely=0.748, height=57, width=107) self.Label5_9.configure(activebackground="#f9f9f9") self.Label5_9.configure(activeforeground="black") self.Label5_9.configure(background="#68ff3b") self.Label5_9.configure(disabledforeground="#a3a3a3") self.Label5_9.configure(font=font12) self.Label5_9.configure(foreground="#4124b5") self.Label5_9.configure(highlightbackground="#d9d9d9") self.Label5_9.configure(highlightcolor="black") self.Label5_9.configure(text='''Total :''') self.Label5_9.configure(width=107) self.buttncontinue = tk.Button(self.Frame1) self.buttncontinue.place(relx=0.763, rely=0.887, height=42, width=115) self.buttncontinue.configure(activebackground="#ececec") self.buttncontinue.configure(activeforeground="#000000") self.buttncontinue.configure(background="#5a54ff") self.buttncontinue.configure(disabledforeground="#a3a3a3") self.buttncontinue.configure(font=font13) self.buttncontinue.configure(foreground="#fafffc") self.buttncontinue.configure(highlightbackground="#d9d9d9") self.buttncontinue.configure(highlightcolor="black") self.buttncontinue.configure(pady="0") self.buttncontinue.configure(command=self.continues, text='''CONTINUE''') self.buttncontinue.configure(width=115) self.style.map('TCheckbutton', background=[('selected', _bgcolor), ('active', _ana2color)]) self.checkbox = ttk.Checkbutton(self.Frame1) self.checkbox.place(relx=0.216, rely=0.835, relwidth=0.706, relheight=0.0, height=21) self.checkbox.configure(variable=unknown_support.tch66) self.checkbox.configure(takefocus="") self.checkbox.configure( text='''All the data filled is correct I Wish To Continue''') self.checkbox.configure(width=491) self.Label4 = tk.Label(top) self.Label4.place(relx=0.377, rely=0.057, height=101, width=444) self.Label4.configure(background="#ffff24") self.Label4.configure(disabledforeground="#a3a3a3") self.Label4.configure(font=font9) self.Label4.configure(foreground="#35a025") self.Label4.configure(text='''New Entry''') self.Label4.configure(width=444) self.txtid = tk.Entry(top) self.txtid.place(relx=0.52, rely=0.262, height=30, relwidth=0.198) self.txtid.configure(background="white") self.txtid.configure(disabledforeground="#a3a3a3") self.txtid.configure(font="TkFixedFont") self.txtid.configure(foreground="#000000") self.txtid.configure(insertbackground="black") self.txtid.configure(width=304) self.txtwatertax = tk.Entry(top) self.txtwatertax.place(relx=0.52, rely=0.661, height=30, relwidth=0.198) self.txtwatertax.configure(background="white") self.txtwatertax.configure(disabledforeground="#a3a3a3") self.txtwatertax.configure(font="TkFixedFont") self.txtwatertax.configure(foreground="#000000") self.txtwatertax.configure(insertbackground="black") self.txtwatertax.configure(width=304) self.txttotal = tk.Entry(top) self.txttotal.place(relx=0.52, rely=0.718, height=30, relwidth=0.198) self.txttotal.configure(background="white") self.txttotal.configure(disabledforeground="#a3a3a3") self.txttotal.configure(font="TkFixedFont") self.txttotal.configure(foreground="#000000") self.txttotal.configure(insertbackground="black") self.txttotal.configure(width=304) self.txthousetax = tk.Entry(top) self.txthousetax.place(relx=0.52, rely=0.49, height=30, relwidth=0.198) self.txthousetax.configure(background="white") self.txthousetax.configure(disabledforeground="#a3a3a3") self.txthousetax.configure(font="TkFixedFont") self.txthousetax.configure(foreground="#000000") self.txthousetax.configure(insertbackground="black") self.txthousetax.configure(width=304) self.txthealthtax = tk.Entry(top) self.txthealthtax.place(relx=0.52, rely=0.547, height=30, relwidth=0.198) self.txthealthtax.configure(background="white") self.txthealthtax.configure(disabledforeground="#a3a3a3") self.txthealthtax.configure(font="TkFixedFont") self.txthealthtax.configure(foreground="#000000") self.txthealthtax.configure(insertbackground="black") self.txthealthtax.configure(width=304) self.txtlighttax = tk.Entry(top) self.txtlighttax.place(relx=0.52, rely=0.604, height=30, relwidth=0.198) self.txtlighttax.configure(background="white") self.txtlighttax.configure(disabledforeground="#a3a3a3") self.txtlighttax.configure(font="TkFixedFont") self.txtlighttax.configure(foreground="#000000") self.txtlighttax.configure(insertbackground="black") self.txtlighttax.configure(width=304) self.Label1_1 = tk.Label(top) self.Label1_1.place(relx=0.117, rely=0.023, height=81, width=156) self.Label1_1.configure(activebackground="#f9f9f9") self.Label1_1.configure(activeforeground="black") self.Label1_1.configure(background="#ffff24") self.Label1_1.configure(disabledforeground="#a3a3a3") self.Label1_1.configure(font=font9) self.Label1_1.configure(foreground="#2212ff") self.Label1_1.configure(highlightbackground="#d9d9d9") self.Label1_1.configure(highlightcolor="black") self.Label1_1.configure(text='''2019''') self.Label1_11 = tk.Label(top) self.Label1_11.place(relx=0.826, rely=0.182, height=81, width=246) self.Label1_11.configure(activebackground="#f9f9f9") self.Label1_11.configure(activeforeground="black") self.Label1_11.configure(background="#ffff24") self.Label1_11.configure(disabledforeground="#a3a3a3") self.Label1_11.configure(font=font14) self.Label1_11.configure(foreground="#268930") self.Label1_11.configure(highlightbackground="#d9d9d9") self.Label1_11.configure(highlightcolor="black") self.Label1_11.configure(text='''Village : Kalamwadi''') self.Label1_11.configure(width=246) self.Label1_12 = tk.Label(top) self.Label1_12.place(relx=0.826, rely=0.251, height=41, width=246) self.Label1_12.configure(activebackground="#f9f9f9") self.Label1_12.configure(activeforeground="black") self.Label1_12.configure(background="#ffff24") self.Label1_12.configure(disabledforeground="#a3a3a3") self.Label1_12.configure(font=font14) self.Label1_12.configure(foreground="#268930") self.Label1_12.configure(highlightbackground="#d9d9d9") self.Label1_12.configure(highlightcolor="black") self.Label1_12.configure(text='''Dist. : Sangli''') self.Label1_12.configure(width=246) self.Label6 = tk.Label(top) self.Label6.place(relx=0.904, rely=0.125, height=27, width=78) self.Label6.configure(background="#ffff24") self.Label6.configure(disabledforeground="#a3a3a3") self.Label6.configure(font=font15) self.Label6.configure(foreground="#000000") self.Label6.configure(text='''Hi User !!!''') self.Label7 = tk.Label(top) self.Label7.place(relx=0.904, rely=0.034, height=74, width=74) self.Label7.configure(background="#d9d9d9") self.Label7.configure(disabledforeground="#a3a3a3") self.Label7.configure(foreground="#000000") self._img1 = tk.PhotoImage(file="./login3.png") self.Label7.configure(image=self._img1) self.Label7.configure(text='''Label''') self.Label7.configure(width=74) self.TSeparator1 = ttk.Separator(top) self.TSeparator1.place(relx=0.826, rely=0.171, relwidth=0.176) self.TSeparator1_13 = ttk.Separator(top) self.TSeparator1_13.place(relx=0.829, rely=0.33, relwidth=0.202) self.Label8 = tk.Label(top) self.Label8.place(relx=0.026, rely=0.513, height=222, width=318) self.Label8.configure(background="#d9d9d9") self.Label8.configure(disabledforeground="#a3a3a3") self.Label8.configure(foreground="#000000") self._img2 = tk.PhotoImage(file="./login1.png") self.Label8.configure(image=self._img2) self.Label8.configure(text='''Label''') self.Label9 = tk.Label(top) self.Label9.place(relx=0.891, rely=0.945, height=21, width=117) self.Label9.configure(background="#ffff24") self.Label9.configure(disabledforeground="#a3a3a3") self.Label9.configure(foreground="#000000") self.Label9.configure(text='''Server Status : Online''') self.Label9_15 = tk.Label(top) self.Label9_15.place(relx=0.884, rely=0.968, height=21, width=147) self.Label9_15.configure(activebackground="#f9f9f9") self.Label9_15.configure(activeforeground="black") self.Label9_15.configure(background="#ffff24") self.Label9_15.configure(disabledforeground="#a3a3a3") self.Label9_15.configure(foreground="#000000") self.Label9_15.configure(highlightbackground="#d9d9d9") self.Label9_15.configure(highlightcolor="black") self.Label9_15.configure(text='''Connected To Local Host''') self.Label9_15.configure(width=147)
def SettingsUI(self): """Settings UI generated using Toplevel with widgets in a Themed Tk Frame""" SettingsWindow = Tkinter.Toplevel(self.parent) SettingsWindow.title("GLIMPS Settings") SettingsFrame = ttk.Frame(SettingsWindow) SettingsFrame.grid() # Output files produced by pipeline Outputs = ttk.LabelFrame(SettingsFrame, text="Outputs") Outputs.grid(row=0, columnspan=3, sticky="NSWE", padx=10, pady=5) PAmat = ttk.Checkbutton(Outputs, variable=self.PAMatrix, text='Presence Absence Matrix') PAmat.grid(row=0, column=0, sticky='NSW', padx=5, pady=5) POCPmat = ttk.Checkbutton( Outputs, variable=self.POCP, text= 'Percentage of Shared Protein Families Matrix (Only in automated clustering)' ) POCPmat.grid(row=1, column=0, sticky='NSW', padx=5, pady=5) AAImat = ttk.Checkbutton(Outputs, variable=self.AAI, text='Average Amino Acid Identity Matrix') AAImat.grid(row=2, column=0, sticky='NSW', padx=5, pady=5) Phylo = ttk.Checkbutton(Outputs, variable=self.Phylogeny, text='Phylogenetic Tree') Phylo.grid(row=3, column=0, sticky='NSW', padx=5, pady=5) # Pipeline algorithm settings Pipeline_Settings = ttk.LabelFrame(SettingsFrame, text="Pipeline Settings") Pipeline_Settings.grid(row=1, columnspan=3, sticky="NSWE", padx=10, pady=5) Poly = ttk.Checkbutton( Pipeline_Settings, variable=self.Polymorphic, text= 'Use only polymorphic amino acid positions in phylogenetic analysis' ) Poly.grid(row=0, columnspan=2, sticky='NSW', padx=10, pady=5) SC = ttk.Checkbutton( Pipeline_Settings, variable=self.Single_Copy, text='Use only single copy homologs (Only in automated clustering)' ) SC.grid(row=1, columnspan=2, sticky='NSW', padx=10, pady=5) FC = ttk.Checkbutton( Pipeline_Settings, variable=self.Fast_Clust, text= 'Skip HMMer steps in automated core protein identification (Fast Clustering)' ) FC.grid(row=2, columnspan=2, sticky='NSW', padx=10, pady=5) FP = ttk.Checkbutton( Pipeline_Settings, variable=self.Fast_Phylo, text= 'Skip RAxML step in phylogenetic tree construction (Fast Phylogeny)' ) FP.grid(row=3, columnspan=2, sticky='NSW', padx=10, pady=5) ThreadLabel = ttk.Label( Pipeline_Settings, text='Number of threads to utilize in pipeline') ThreadLabel.grid(row=4, column=0, sticky='NSE', padx=10, pady=5) Num_Thread = self.Threads.get() Thread = Tkinter.Spinbox(Pipeline_Settings, textvariable=self.Threads, from_=1, to=Num_Thread, width=3) Thread.grid(row=4, column=1, sticky='NSW', padx=10, pady=5) PDLabel = ttk.Label( Pipeline_Settings, text='Acceptnce threshold for distribution of core proteins (%)') PDLabel.grid(row=5, column=0, sticky='NSE', padx=10, pady=5) PD = Tkinter.Spinbox(Pipeline_Settings, textvariable=self.Protein_Distribution, from_=1, to=100, width=3) PD.grid(row=5, column=1, sticky='NSW', padx=10, pady=5) # Pipeline dependencies Dependencies = ttk.LabelFrame(SettingsFrame, text='Dependencies') Dependencies.grid(row=3, columnspan=3, sticky="NSWE", padx=10, pady=5) CDHITname = ttk.Label(Dependencies, text='CD-Hit') CDHITname.grid(row=0, column=0, sticky='E', padx=5) CDHITentry = ttk.Entry(Dependencies, textvariable=self.CDHIT, width=30) CDHITentry.grid(row=0, column=1, sticky='NSWE', padx=5) CDHITSelect = ttk.Button(Dependencies, text='Browse...', command=self.getCDHITFile) CDHITSelect.grid(row=0, column=2, sticky='E', padx=5) JACKHMMERname = ttk.Label(Dependencies, text='JackHMMer') JACKHMMERname.grid(row=1, column=0, sticky='E', padx=5) JACKHMMERentry = ttk.Entry(Dependencies, textvariable=self.JACKHMMER, width=30) JACKHMMERentry.grid(row=1, column=1, sticky='NSWE', padx=5) JACKHMMERSelect = ttk.Button(Dependencies, text='Browse...', command=self.getJACKHMMERFile) JACKHMMERSelect.grid(row=1, column=2, sticky='NSWE', padx=5) HMMbuildname = ttk.Label(Dependencies, text='HMMbuild') HMMbuildname.grid(row=2, column=0, sticky='E', padx=5) HMMbuildentry = ttk.Entry(Dependencies, textvariable=self.HMMBUILD, width=30) HMMbuildentry.grid(row=2, column=1, sticky='NSWE', padx=5) HMMbuildSelect = ttk.Button(Dependencies, text='Browse...', command=self.getHMMBUILDFile) HMMbuildSelect.grid(row=2, column=2, sticky='NSWE', padx=5) HMMsearchname = ttk.Label(Dependencies, text='HMMsearch') HMMsearchname.grid(row=3, column=0, sticky='E', padx=5) HMMsearchentry = ttk.Entry(Dependencies, textvariable=self.HMMSEARCH, width=30) HMMsearchentry.grid(row=3, column=1, sticky='NSWE', padx=5) HMMsearchSelect = ttk.Button(Dependencies, text='Browse...', command=self.getHMMSEARCHFile) HMMsearchSelect.grid(row=3, column=2, sticky='NSWE', padx=5) ClustalOname = ttk.Label(Dependencies, text='Clustal Omega') ClustalOname.grid(row=4, column=0, sticky='E', padx=5) ClustalOentry = ttk.Entry(Dependencies, textvariable=self.ClustalOmega, width=30) ClustalOentry.grid(row=4, column=1, sticky='NSWE', padx=5) ClustalOSelect = ttk.Button(Dependencies, text='Browse...', command=self.getClustalOmegaFile) ClustalOSelect.grid(row=4, column=2, sticky='NSWE', padx=5) TrimAlname = ttk.Label(Dependencies, text='TrimAl') TrimAlname.grid(row=5, column=0, sticky='E', padx=5) TrimAlentry = ttk.Entry(Dependencies, textvariable=self.TrimAl, width=30) TrimAlentry.grid(row=5, column=1, sticky='NSWE', padx=5) TrimAlSelect = ttk.Button(Dependencies, text='Browse...', command=self.getTrimAlFile) TrimAlSelect.grid(row=5, column=2, sticky='NSWE', padx=5) FastTreename = ttk.Label(Dependencies, text='FastTree') FastTreename.grid(row=6, column=0, sticky='E', padx=5) FastTreeentry = ttk.Entry(Dependencies, textvariable=self.FastTree, width=30) FastTreeentry.grid(row=6, column=1, sticky='NSWE', padx=5) FastTreeSelect = ttk.Button(Dependencies, text='Browse...', command=self.getFastTreeFile) FastTreeSelect.grid(row=6, column=2, sticky='NSWE', padx=5) RAxMLname = ttk.Label(Dependencies, text='RAxML') RAxMLname.grid(row=7, column=0, sticky='E', padx=5) RAxMLentry = ttk.Entry(Dependencies, textvariable=self.RAxML, width=30) RAxMLentry.grid(row=7, column=1, sticky='NSWE', padx=5) RAxMLSelect = ttk.Button(Dependencies, text='Browse...', command=self.getRAxMLFile) RAxMLSelect.grid(row=7, column=2, sticky='NSWE', padx=5) # Close settings button Close_Settings = ttk.Button(SettingsFrame, text='Close Settings', command=SettingsWindow.destroy) Close_Settings.grid(row=4, columnspan=3, pady=5)
def __init__(self): TkDialog.__init__(self) #Here you can make things pretty self.wm_geometry("700x700") self.title("Test Tk/Ttk Dialog") #How you might add an icon... #self.wm_iconbitmap('./my_icon.ico') #Or use (with binary_string from decompressing say a base64 zlib compressed icon in a string. #self.set_icon(binary_string) #build a list of controls and labels #First, add a simple menu... #The options menu items are checkable. The variable associated with each menu item is the sanitized menu_name_menu_item self.add_menu( "File", ["Open configuration", "Save configuration", "|", "Exit"]) self.add_menu("Edit", ["Copy", "Paste"]) self.add_menu("Options", ["1_Option 1", "0_Option 2", "0_Option 3"]) self.add_menu("Help", ["About"]) self.labelvar = tk.StringVar() self.labelvar.set( "Click on a widget to see this message change. Mouse-over the label to see a tooltip" ) # in some cases, it can be advantageous to name the widget via the "name" argument. # This widget will then be available through TestDialog.name # In most cases though, you only need to specify an arrayvar variable and the arrayvar name will be used instead widget = ttk.Label(self.mainframe, textvariable=self.labelvar, name="label1") tooltip = "The following message is changed in Update() in response to any changes to the UI" self.add_control("Info", widget, tooltip=tooltip) widget = [ ttk.Radiobutton(self.mainframe, variable=self.arrayvar("radiobutton"), text="one", value=1), ttk.Radiobutton(self.mainframe, variable=self.arrayvar("radiobutton"), text="two", value=2), ttk.Radiobutton(self.mainframe, variable=self.arrayvar("radiobutton"), text="three", value=3), ttk.Radiobutton(self.mainframe, variable=self.arrayvar("radiobutton"), text="four", value=4) ] self.add_control("Radio", widget) widget = [ ttk.Checkbutton(self.mainframe, variable=self.arrayvar("checkbutton1"), text="Option 1", onvalue="on", offvalue="off"), ttk.Checkbutton(self.mainframe, variable=self.arrayvar("checkbutton2"), text="Option 2", onvalue="on", offvalue="off"), ttk.Checkbutton(self.mainframe, variable=self.arrayvar("checkbutton3"), text="Option 3", onvalue="on", offvalue="off"), ] self.add_control("Checkbox", widget) widget = ttk.Entry(self.mainframe, textvariable=self.arrayvar("entry")) self.add_control("Entry", widget) if 1: #This is the safe way of doing this. row = self.mainframe else: #XXX Works in Windows for some reason, but really isn't advised. For instance, won't work in Linux. #As of Tkinter 8.5, we can't change the parent of a tk widget. #so (on Windows) we can define a ttk.Frame, then use it as a parent for more widgets row = ttk.Frame(self.mainframe) widget = [ ttk.Entry(row, textvariable=self.arrayvar("entryx"), width=2), ttk.Entry(row, textvariable=self.arrayvar("entryy"), width=2), ttk.Entry(row, textvariable=self.arrayvar("entryz"), width=2) ] tick = self.arrayvar("line_tick", "off"), "Click me" self.add_control("Multiple entries", widget, "linewidget", tick=tick) values = ["Value 1", "Value 2"] widget = ttk.Combobox(self.mainframe, textvariable=self.arrayvar("combobox"), state="readonly", values=values) self.add_control("Combobox", widget) self.combobox_values = values widget = spinbox = tk.Spinbox(self.mainframe, textvariable=self.arrayvar("spinbox"), from_=1, to=11) tick = self.arrayvar("spinbox_tick", "off"), "Click me" self.add_control("Spinbox + tick", widget, tick=tick) # Here we need to specify a name to access via app("scale2") (for example, to enable/disable the widget) widget = tk.Scale(self.mainframe, variable=self.arrayvar("scale1"), from_=0, to=100, tickinterval=20, orient="horizontal", showvalue=True, name="scale1") self.add_control("Scale 0-100", widget) widget = tk.Scale(self.mainframe, variable=self.arrayvar("scale2"), from_=0, to=100, tickinterval=20, orient="horizontal", showvalue=True, name="scale2") tick = self.arrayvar("scale_tick", "on"), "Enabled" self.add_control("Scale + tick", widget, tick=tick) widget = ttk.Button(self.mainframe, text="click to display values array", command=self.OnDump) self.add_control("Button", widget) self.figure = Figure(figsize=(10, 10), dpi=80) self.canvas = FigureCanvasTkAgg(self.figure, master=self.mainframe) self.add_control(None, self.canvas.get_tk_widget()) if 0: #XXX This does not work in Mint 17 self.toolbar = NavigationToolbar2TkAgg(self.canvas, self.mainframe) self.add_control(None, self.toolbar) #we have all the ingredients, bake me a dialog box! self.bake(has_live=True, has_cancel=True) #Here you do the vars print("setting some values...") self.arrayvar["scale_tick"] = "on" self.arrayvar["spinbox_tick"] = "off" self.arrayvar["entry"] = "something witty" self.arrayvar["entryx"] = "1" self.arrayvar["entryy"] = "2" self.arrayvar["entryz"] = "3" self.arrayvar["radiobutton"] = 2 self.arrayvar["checkbutton"] = "on" self.arrayvar["spinbox"] = 11 self.arrayvar["combobox"] = self.combobox_values[0] ax1 = self.figure.add_axes([0.1, 0.1, 0.8, 0.8]) t = np.arange(0.0, 2.0, 0.01) s = np.sin(2 * np.pi * t) ax1.plot(t, s) ax1.set_xlabel('time (s)') ax1.set_ylabel('voltage (mV)') ax1.set_title('About as simple as it gets, folks') ax1.grid(True)
def bake(self, has_cancel=False, has_live=None, has_preview=None, has_ok=False): '''Given a list of controls and labels, bake the dialog''' #adding the controls / labels to the mainframe n_widgets = len(self._controls) #If there's a Canvas, make that the expanding object. Otherwise the last row is. hasCanvas = 0 # The central columns configurationuration for i in range(self._spanwidgets): self.mainframe.columnconfigure(i + 1, weight=self._spanwidgets) for i in range(n_widgets): ctrl_name = self._controlnames[i] label = self._labels[ctrl_name] tooltip = self._tooltips[ctrl_name] #This is the span if no label, no tick: span = 2 + self._spanwidgets #The widget column. Set to 0 if no label... if label is not None: span -= 1 if label.strip() != "": l = ttk.Label(self.mainframe, text=label.strip() + ' :') l.grid(column=0, row=i, sticky=(tk.E, tk.W)) if tooltip is not None: tip = ToolTip(l, tooltip) col_widget = 1 else: col_widget = 0 #Now add the widget widget = self._controls[ctrl_name] widget_parent = self._parents[ctrl_name] tickcontrol = self._tickcontrols[ctrl_name] if widget is None: continue #we need to add multiple widgets if type(widget) == list: nw = len(widget) if widget_parent == None: if tickcontrol is None: nw = nw - 1 total_span = self._spanwidgets for j in range(nw): w = widget[j] if j == nw - 1: span = total_span else: span = 1 if w is not None: hasCanvas += self._bakewidget( w, i, col_widget + j, span) total_span -= 1 else: widget_parent.pack(side=tk.TOP, fill=tk.X, padx=0, pady=0) if tickcontrol is not None: span -= 1 for j in range(nw): w = widget[j] if j < nw - 1: padx = (0, 10) else: padx = 0 w.pack(side=tk.LEFT, expand=tk.YES, fill=tk.X, padx=padx) hasCanvas += self._bakewidget(widget_parent, i, col_widget, span) else: if tickcontrol is not None: span -= 1 hasCanvas += self._bakewidget(widget, i, col_widget, span) #Now add the tick if tickcontrol is None and type(widget) == list: tickcontrol = widget[-1] if tickcontrol is not None and type(tickcontrol) != int: tickcontrol.grid(column=1 + self._spanwidgets, row=i, columnspan=1) tickcontrol.grid_configure(padx=0, pady=5) tickcontrol.grid_configure(sticky=(tk.W, tk.E)) #Separator line (used to either pull the canvas down and / or push the OK/Cancel buttons to the bottom) if hasCanvas > 0: weight = 0 sticky = (tk.S, tk.N, tk.E, tk.W) else: weight = 1 sticky = (tk.S, tk.E, tk.W) if True in [has_preview, has_live, has_ok, has_cancel]: widget = ttk.Separator(self.mainframe, orient=tk.HORIZONTAL) widget.grid_configure(padx=0, pady=5) widget.grid(column=0, row=n_widgets, columnspan=self._spanwidgets + 2, sticky=sticky) self.mainframe.rowconfigure(n_widgets, weight=weight) #live preview and Cancel/OK buttons if has_preview is not None and has_preview != False: if has_preview is True: has_preview = "Preview" widget = ttk.Button(self.mainframe, text=has_preview, command=self.OnPreview) widget.grid(column=0, row=n_widgets + 1, sticky=(tk.S, tk.W)) elif has_live is not None and has_live != False: if has_live is True: has_live = "Live" widget = ttk.Checkbutton( self.mainframe, text=has_live, variable=self.arrayvar("check_liveview"), onvalue="on", offvalue="off") widget.grid(column=0, row=n_widgets + 1, sticky=(tk.S, tk.W), padx=0) if has_cancel: c = self._spanwidgets if has_ok == False: c += 1 widget = ttk.Button(self.mainframe, text="Cancel", command=self.OnCancel) widget.grid(column=c, row=n_widgets + 1, sticky=(tk.S, tk.E)) if has_ok: widget = ttk.Button(self.mainframe, text="OK", command=self.OnOK) widget.grid(column=self._spanwidgets + 1, row=n_widgets + 1, sticky=(tk.S, tk.E)) #self.mainframe.rowconfigure(n_widgets+1, weight=0) self._old_arrayvar = self.arrayvar.get() widget_type = widget.__class__.__name__.strip() self.arrayvar.callback(self.OnTrace)
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 {.SF NS Text} -size 14" 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("592x406+482+130") top.title("AIDAhisto") top.configure(background="#d9d9d9") self.Labelframe1 = tk.LabelFrame(top) self.Labelframe1.place(relx=0.068, rely=0.049, relheight=0.135, relwidth=0.878) self.Labelframe1.configure(relief='groove') self.Labelframe1.configure(foreground="black") self.Labelframe1.configure(text='''Input image''') self.Labelframe1.configure(background="#d9d9d9") self.Labelframe1.configure(width=520) self.input_en = tk.Entry(self.Labelframe1) self.input_en.place(relx=0.019, rely=0.364, height=27, relwidth=0.754, bordermode='ignore') self.input_en.configure(background="white") self.input_en.configure(font="-family {Monaco} -size 11") self.input_en.configure(foreground="#000000") self.input_en.configure(insertbackground="black") self.input_en.configure( textvariable=AIDAhisto_gui_support.inputFilename) self.input_en.configure(width=392) self.TButton1 = ttk.Button(self.Labelframe1) self.TButton1.place(relx=0.808, rely=0.364, height=24, width=87, bordermode='ignore') self.TButton1.configure(command=AIDAhisto_gui_support.openfile_cmd) self.TButton1.configure(takefocus="") self.TButton1.configure(text='''Open''') self.TButton1.configure(cursor="fleur") self.Labelframe2 = tk.LabelFrame(top) self.Labelframe2.place(relx=0.338, rely=0.222, relheight=0.333, relwidth=0.321) self.Labelframe2.configure(relief='groove') self.Labelframe2.configure(foreground="black") self.Labelframe2.configure(text='''Options''') self.Labelframe2.configure(background="#d9d9d9") self.Labelframe2.configure(width=190) self.style.map('TCheckbutton', background=[('selected', _bgcolor), ('active', _ana2color)]) self.fast_bt = ttk.Checkbutton(self.Labelframe2) self.fast_bt.place(relx=0.105, rely=0.222, relwidth=0.742, relheight=0.0, height=22, bordermode='ignore') self.fast_bt.configure(variable=AIDAhisto_gui_support.fast) self.fast_bt.configure(command=AIDAhisto_gui_support.fast_cmd) self.fast_bt.configure(takefocus="") self.fast_bt.configure(text='''Fast detection''') self.fast_bt.configure(width=141) self.dark_bt = ttk.Checkbutton(self.Labelframe2) self.dark_bt.place(relx=0.105, rely=0.444, relwidth=0.742, relheight=0.0, height=22, bordermode='ignore') self.dark_bt.configure(variable=AIDAhisto_gui_support.dark) self.dark_bt.configure(command=AIDAhisto_gui_support.dark_cmd) self.dark_bt.configure(takefocus="") self.dark_bt.configure(text='''Invert Image''') self.dark_bt.configure(width=141) self.bar_bt = ttk.Checkbutton(self.Labelframe2) self.bar_bt.place(relx=0.105, rely=0.667, relwidth=0.742, relheight=0.0, height=22, bordermode='ignore') self.bar_bt.configure(variable=AIDAhisto_gui_support.bar) self.bar_bt.configure(command=AIDAhisto_gui_support.bar_cmd) self.bar_bt.configure(takefocus="") self.bar_bt.configure(text='''Non-circular cells''') self.bar_bt.configure(width=141) self.Labelframe3 = tk.LabelFrame(top) self.Labelframe3.place(relx=0.068, rely=0.222, relheight=0.333, relwidth=0.236) self.Labelframe3.configure(relief='groove') self.Labelframe3.configure(foreground="black") self.Labelframe3.configure(text='''Color Channel''') self.Labelframe3.configure(background="#d9d9d9") self.Labelframe3.configure(width=140) self.style.map('TRadiobutton', background=[('selected', _bgcolor), ('active', _ana2color)]) self.red_rd = ttk.Radiobutton(self.Labelframe3) self.red_rd.place(relx=0.143, rely=0.222, relwidth=0.714, relheight=0.0, height=22, bordermode='ignore') self.red_rd.configure(variable=AIDAhisto_gui_support.red_v) self.red_rd.configure(command=AIDAhisto_gui_support.red_cmd) self.red_rd.configure(takefocus="") self.red_rd.configure(text='''Red''') self.red_rd.configure(width=100) self.green_rb = ttk.Radiobutton(self.Labelframe3) self.green_rb.place(relx=0.143, rely=0.444, relwidth=0.714, relheight=0.0, height=22, bordermode='ignore') self.green_rb.configure(variable=AIDAhisto_gui_support.green_v) self.green_rb.configure(command=AIDAhisto_gui_support.green_cmd) self.green_rb.configure(takefocus="") self.green_rb.configure(text='''Green''') self.green_rb.configure(width=100) self.blue_rb = ttk.Radiobutton(self.Labelframe3) self.blue_rb.place(relx=0.143, rely=0.667, relwidth=0.714, relheight=0.0, height=22, bordermode='ignore') self.blue_rb.configure(variable=AIDAhisto_gui_support.blue_v) self.blue_rb.configure(command=AIDAhisto_gui_support.blue_cmd) self.blue_rb.configure(takefocus="") self.blue_rb.configure(text='''Blue''') self.blue_rb.configure(width=100) self.Labelframe4 = tk.LabelFrame(top) self.Labelframe4.place(relx=0.676, rely=0.222, relheight=0.16, relwidth=0.27) self.Labelframe4.configure(relief='groove') self.Labelframe4.configure(foreground="black") self.Labelframe4.configure(text='''Cell width [pixel]''') self.Labelframe4.configure(background="#d9d9d9") self.Labelframe4.configure(width=160) self.width_scale = ttk.Scale(self.Labelframe4, from_=1, to=50.0) self.width_scale.place(relx=0.063, rely=0.462, relwidth=0.563, relheight=0.0, height=24, bordermode='ignore') self.width_scale.configure(command=AIDAhisto_gui_support.width_cmd) self.width_scale.configure(variable=AIDAhisto_gui_support.cell_widthV) self.width_scale.configure(value="1") self.width_scale.configure(length="90") self.width_scale.configure(takefocus="") self.cell_width_entry = tk.Entry(self.Labelframe4) self.cell_width_entry.place(relx=0.625, rely=0.462, height=27, relwidth=0.325, bordermode='ignore') self.cell_width_entry.configure(background="white") self.cell_width_entry.configure(font="-family {Monaco} -size 11") self.cell_width_entry.configure(foreground="#000000") self.cell_width_entry.configure(insertbackground="black") self.cell_width_entry.configure(readonlybackground="#eaeaea") self.cell_width_entry.configure(state='readonly') self.cell_width_entry.configure( textvariable=AIDAhisto_gui_support.cell_width_entry) self.cell_width_entry.configure(width=52) self.Labelframe5 = tk.LabelFrame(top) self.Labelframe5.place(relx=0.676, rely=0.394, relheight=0.16, relwidth=0.27) self.Labelframe5.configure(relief='groove') self.Labelframe5.configure(foreground="black") self.Labelframe5.configure(text='''Cell distance [pixel]''') self.Labelframe5.configure(background="#d9d9d9") self.Labelframe5.configure(width=160) self.dist_scale = ttk.Scale(self.Labelframe5, from_=0.5, to=50.0) self.dist_scale.place(relx=0.063, rely=0.462, relwidth=0.563, relheight=0.0, height=24, bordermode='ignore') self.dist_scale.configure(command=AIDAhisto_gui_support.dist_cmd) self.dist_scale.configure(variable=AIDAhisto_gui_support.min_dist) self.dist_scale.configure(value="1") self.dist_scale.configure(length="90") self.dist_scale.configure(takefocus="") self.dis_en = tk.Entry(self.Labelframe5) self.dis_en.place(relx=0.625, rely=0.462, height=27, relwidth=0.325, bordermode='ignore') self.dis_en.configure(background="white") self.dis_en.configure(font="-family {Monaco} -size 11") self.dis_en.configure(foreground="#000000") self.dis_en.configure(insertbackground="black") self.dis_en.configure(readonlybackground="#eaeaea") self.dis_en.configure(state='readonly') self.dis_en.configure( textvariable=AIDAhisto_gui_support.cell_dist_entry) self.dis_en.configure(width=52) self.menubar = tk.Menu(top, font=( '.SF NS Text', 14, ), bg=_bgcolor, fg=_fgcolor) top.configure(menu=self.menubar) self.Labelframe7 = tk.LabelFrame(top) self.Labelframe7.place(relx=0.068, rely=0.567, relheight=0.357, relwidth=0.591) self.Labelframe7.configure(relief='groove') self.Labelframe7.configure(foreground="black") self.Labelframe7.configure(text='''Additional information''') self.Labelframe7.configure(background="#d9d9d9") self.Labelframe7.configure(width=350) self.roi_en = tk.Entry(self.Labelframe7) self.roi_en.place(relx=0.029, rely=0.138, height=27, relwidth=0.691, bordermode='ignore') self.roi_en.configure(background="white") self.roi_en.configure(font="-family {Monaco} -size 11") self.roi_en.configure(foreground="#000000") self.roi_en.configure(insertbackground="black") self.roi_en.configure(textvariable=AIDAhisto_gui_support.roi_inV) self.roi_en.configure(width=242) self.ref_en = tk.Entry(self.Labelframe7) self.ref_en.place(relx=0.029, rely=0.414, height=27, relwidth=0.691, bordermode='ignore') self.ref_en.configure(background="white") self.ref_en.configure(font="-family {Monaco} -size 11") self.ref_en.configure(foreground="#000000") self.ref_en.configure(insertbackground="black") self.ref_en.configure(textvariable=AIDAhisto_gui_support.ref_inV) self.ref_en.configure(width=242) self.Entry4 = tk.Entry(self.Labelframe7) self.Entry4.place(relx=0.029, rely=0.69, height=27, relwidth=0.691, bordermode='ignore') self.Entry4.configure(background="white") self.Entry4.configure(font="-family {Monaco} -size 11") self.Entry4.configure(foreground="#000000") self.Entry4.configure(insertbackground="black") self.Entry4.configure( textvariable=AIDAhisto_gui_support.listofRoiNames) self.Entry4.configure(width=242) self.roi_bt = ttk.Button(self.Labelframe7) self.roi_bt.place(relx=0.743, rely=0.138, height=24, width=77, bordermode='ignore') self.roi_bt.configure(command=AIDAhisto_gui_support.roi_cmd) self.roi_bt.configure(takefocus="") self.roi_bt.configure(text='''Open''') self.roi_bt.configure(width=77) self.ref_bt = ttk.Button(self.Labelframe7) self.ref_bt.place(relx=0.743, rely=0.414, height=24, width=77, bordermode='ignore') self.ref_bt.configure(command=AIDAhisto_gui_support.ref_cmd) self.ref_bt.configure(takefocus="") self.ref_bt.configure(text='''Open''') self.ref_bt.configure(width=77) self.list_bt = ttk.Button(self.Labelframe7) self.list_bt.place(relx=0.743, rely=0.69, height=24, width=77, bordermode='ignore') self.list_bt.configure(command=AIDAhisto_gui_support.list_cmd) self.list_bt.configure(takefocus="") self.list_bt.configure(text='''Open''') self.list_bt.configure(width=77) self.apply_bt = ttk.Button(top) self.apply_bt.place(relx=0.709, rely=0.788, height=44, width=127) self.apply_bt.configure(command=AIDAhisto_gui_support.apply_cmd) self.apply_bt.configure(takefocus="") self.apply_bt.configure(text='''Apply''') self.apply_bt.configure(width=127) self.Labelframe6 = tk.LabelFrame(top) self.Labelframe6.place(relx=0.676, rely=0.567, relheight=0.16, relwidth=0.27) self.Labelframe6.configure(relief='groove') self.Labelframe6.configure(foreground="black") self.Labelframe6.configure(text='''Threshold''') self.Labelframe6.configure(background="#d9d9d9") self.Labelframe6.configure(width=160) self.threshold_scale = ttk.Scale(self.Labelframe6, from_=1, to=50) self.threshold_scale.place(relx=0.063, rely=0.462, relwidth=0.563, relheight=0.0, height=24, bordermode='ignore') self.threshold_scale.configure( command=AIDAhisto_gui_support.threshold_cmd) self.threshold_scale.configure( variable=AIDAhisto_gui_support.threshold) self.threshold_scale.configure(value="10") self.threshold_scale.configure(length="90") self.threshold_scale.configure(takefocus="") self.thres_entry = tk.Entry(self.Labelframe6) self.thres_entry.place(relx=0.625, rely=0.462, height=27, relwidth=0.325, bordermode='ignore') self.thres_entry.configure(background="white") self.thres_entry.configure(font="-family {Monaco} -size 11") self.thres_entry.configure(foreground="#000000") self.thres_entry.configure(insertbackground="black") self.thres_entry.configure(readonlybackground="#eaeaea") self.thres_entry.configure(state='readonly') self.thres_entry.configure( textvariable=AIDAhisto_gui_support.threshold_entry) self.thres_entry.configure(width=52)
def BuildPage(self): frame = MyLabelFrame(self, "JPEG Parameters", 0, 0) Label(frame, text="Quality:").grid(row=0, column=0, sticky='W') self.Quality = ttk.Scale(frame, from_=1, to=100, orient='horizontal') self.Quality.grid(row=0, column=1, sticky='W', pady=5) self.Quality.set(JPEG.Quality) ToolTip(self.Quality, 2000) self.QualityAmt = IntVar() self.QualityAmt.set(JPEG.Quality) l = ttk.Label(frame, textvariable=self.QualityAmt, style='DataLabel.TLabel') l.grid(row=0, column=2, sticky='W') ToolTip(l, 2001) # NOW enable callback - else we get an error on self.QualityAmt self.Quality.config(command=self.QualityChanged) Label(frame, text="Restart:").grid(row=1, column=0, sticky='W') l = Label(frame, text="Unclear what to do here!") l.grid(row=1, column=1, columnspan=2, sticky='W') ToolTip(l, 2010) f = ttk.Frame(frame) f.grid(row=2, column=0, columnspan=3, sticky='EW') Label(f, text="Thumbnail:").grid(row=0, column=0, sticky='W') self.ThumbnailNone = MyBooleanVar(JPEG.Thumbnail == None) r = MyRadio(f, "None", True, self.ThumbnailNone, self.ThumbnailChanged, 0, 1, 'W', tip=2015) MyRadio(f, "Set size/quality", False, self.ThumbnailNone, self.ThumbnailChanged, 0, 2, 'W', tip=2020) self.ThumbnailEditFrame = ttk.Frame(f, padding=(15, 0, 0, 0)) self.ThumbnailEditFrame.grid(row=1, column=0, columnspan=3, sticky='EW') Label(self.ThumbnailEditFrame, text="Width:").grid(row=0, column=0, sticky='E') self.WidthCombo = Combobox(self.ThumbnailEditFrame, state='readonly', width=3) self.WidthCombo.bind('<<ComboboxSelected>>', self.SomethingChanged) self.WidthCombo.grid(row=0, column=1, sticky='W') self.WidthComboList = [16, 32, 48, 64, 80, 96, 112, 128] self.WidthCombo['values'] = self.WidthComboList if JPEG.Thumbnail is None: self.WidthCombo.current(0) else: self.WidthCombo.current(int(JPEG.Thumbnail[0] / 16) - 1) ToolTip(self.WidthCombo, 2021) ttk.Label(self.ThumbnailEditFrame, text="Height:", padding=(5, 0, 0, 0)).grid(row=0, column=2, sticky='E') self.HeightCombo = Combobox(self.ThumbnailEditFrame, state='readonly', width=3) self.HeightCombo.bind('<<ComboboxSelected>>', self.SomethingChanged) self.HeightCombo.grid(row=0, column=3, sticky='W') self.HeightCombo['values'] = self.WidthComboList if JPEG.Thumbnail is None: self.HeightCombo.current(0) else: self.HeightCombo.current(int(JPEG.Thumbnail[1] / 16) - 1) ToolTip(self.HeightCombo, 2022) ttk.Label(self.ThumbnailEditFrame, text="Quality:", padding=(5, 0, 0, 0)).grid(row=0, column=4, sticky='E') self.QualityCombo = ttk.Combobox(self.ThumbnailEditFrame, state='readonly', width=3) self.QualityCombo.bind('<<ComboboxSelected>>', self.SomethingChanged) self.QualityCombo.grid(row=0, column=5, sticky='W') self.QualityComboList = [30, 40, 50, 60, 70, 80, 90] self.QualityCombo['values'] = self.QualityComboList if JPEG.Thumbnail is None: self.QualityCombo.current(0) else: self.QualityCombo.current(int((JPEG.Thumbnail[2] - 30) / 10)) ToolTip(self.QualityCombo, 2023) Label(f, text="Bayer:").grid(row=2, column=0, sticky='W') self.Bayer = MyBooleanVar(JPEG.Bayer) MyRadio(f, "Off (default)", False, self.Bayer, self.SomethingChanged, 2, 1, 'W', tip=2030) MyRadio(f, "On", True, self.Bayer, self.SomethingChanged, 2, 2, 'W', tip=2031) frame = MyLabelFrame(self, "EXIF Metadata", 1, 0) self.AddExifBoolean = MyBooleanVar(JPEG.IncludeEXIF) self.AddExifButton = ttk.Checkbutton( frame, text='Add EXIF metadata when saving photo', variable=self.AddExifBoolean, command=lambda e=None: self.SomethingChanged(e)) self.AddExifButton.grid(row=0, column=0, columnspan=2, sticky='W', padx=5) ToolTip(self.AddExifButton, msg=2100) Label(frame,text="Add a user comment to the EXIF metadata") \ .grid(row=1,column=0,sticky='W') self.AddCommentStr = MyStringVar(JPEG.UserComment) okCmd = (self.register(self.SomethingChanged), '%P') e = Entry(frame, textvariable=self.AddCommentStr, validate='key', validatecommand=okCmd) e.grid(row=2, column=0, columnspan=2, sticky='EW') ToolTip(e, msg=2110) self.ThumbnailChanged(None)
def importMenuFrame(): menuFrame = ttk.Frame(root, padding="3 3 12 12") menuFrame.grid(column=0, row=0, sticky=(N, W, E, S)) menuFrame.columnconfigure(0, weight=1) menuFrame.rowconfigure(2, weight=1) ttk.Label(menuFrame, text="Select Target Protein", font="Helvetica 16 bold", foreground="blue").grid(column=1, row=1, sticky=W) pdbLbl = ttk.Label(menuFrame, text='<No PDB>') pdbLbl.grid(column=2, row=1, sticky=W, columnspan=2) chain1Lbl = ttk.Label(menuFrame, text='Chain1') chain2Lbl = ttk.Label(menuFrame, text='Chain2') chain1Drop = ttk.Combobox(menuFrame, width=2) chain2Drop = ttk.Combobox(menuFrame, width=2) chain1Drop.bind('<<ComboboxSelected>>', chain1Sel) chain2Drop.bind('<<ComboboxSelected>>', chain2Sel) chain1Nick.set("") chain2Nick.set("") chain1Lbl.grid(column=2, row=2, sticky=W, padx=5, pady=5) chain1Drop.grid(column=3, row=2, sticky=W, padx=5, pady=5) ttk.Label(menuFrame, text="Chain1 Name").grid(column=4, row=2, sticky=(W, E), padx=5, pady=5) ttk.Entry(menuFrame, width=7, textvariable=chain1Nick).grid(column=5, row=2, sticky=W, padx=5, pady=5) chain2Lbl.grid(column=2, row=3, sticky=W, padx=5, pady=5) chain2Drop.grid(column=3, row=3, sticky=W, padx=5, pady=5) ttk.Label(menuFrame, text="Chain2 Name").grid(column=4, row=3, sticky=(W, E), padx=5, pady=5) ttk.Entry(menuFrame, width=7, textvariable=chain2Nick).grid(column=5, row=3, sticky=W, padx=5, pady=5) ttk.Button( menuFrame, text="Browse", command=lambda: getPdbFile(pdbLbl, chain1Drop, chain2Drop)).grid( column=4, row=1, sticky=W) ttk.Label(menuFrame, text="OR", font="Times 12 bold").grid(column=5, row=1, sticky=E) ttk.Label(menuFrame, text="Enter PDB ID:").grid(column=6, row=1, sticky=E) ttk.Entry(menuFrame, width=7, textvariable=pdbID).grid(column=7, row=1, sticky=W) ttk.Button( menuFrame, text="Download", command=lambda: downloadPdb(pdbLbl, chain1Drop, chain2Drop)).grid( column=8, row=1, sticky=W) ttk.Label(menuFrame, text="Select Conformer(s)", font="Helvetica 16 bold", foreground="blue").grid(column=1, row=4, sticky=W, columnspan=2) var1 = StringVar() conformerList = getItems() selConformers = [] conformerAtoms = [] validCmd = menuFrame.register(isCommaSeparated) ttk.Label(menuFrame, text="Comformer", font="Times 12 bold").grid(column=1, row=5, sticky=(W, E), columnspan=3) ttk.Label(menuFrame, text="atoms4rms (Comma Separated)", font="Times 12 bold").grid(column=4, row=5, sticky=W, columnspan=20) r = 6 for conformer in conformerList: chkd = IntVar() c = ttk.Checkbutton(menuFrame, text=conformer, variable=chkd).grid(column=1, row=r, sticky=(W, E), columnspan=3) selConformers.append(chkd) atoms = StringVar() inFilePath = dirName.get() + "/" + conformer.replace("_lt3.pdb", ".in") if os.path.isfile(inFilePath) and os.access(inFilePath, os.R_OK): inFile = open(inFilePath, "r") pat = r'atoms4rms="(.*)"' for line in inFile: if re.match(pat, line): atoms.set(re.match(pat, line).group(1).replace(" ", ",")) break inFile.close() ttk.Entry(menuFrame, width=15, textvariable=atoms, validate="key", validatecommand=(validCmd, '%P')).grid(column=4, row=r, sticky=W, columnspan=20) conformerAtoms.append(atoms) r = r + 1 r = r + 2 ttk.Label(menuFrame, text="Parameters", font="Helvetica 16 bold", foreground="blue").grid(column=1, row=r, sticky=W, columnspan=2) r = r + 1 vcmd = menuFrame.register(isDouble) ttk.Label(menuFrame, text="Distance").grid(column=1, row=r, sticky=W, columnspan=2) ttk.Entry(menuFrame, width=2, textvariable=distVal, validate="key", validatecommand=(vcmd, '%P')).grid(column=3, row=r, sticky=(W, E)) r = r + 1 ttk.Label(menuFrame, text="Angle").grid(column=1, row=r, sticky=W, columnspan=2) ttk.Entry(menuFrame, width=2, textvariable=anglVal, validate="key", validatecommand=(vcmd, '%P')).grid(column=3, row=r, sticky=(W, E)) r = r + 1 ttk.Label(menuFrame, text="Filter").grid(column=1, row=r, sticky=W, columnspan=2) ttk.Entry(menuFrame, width=2, textvariable=fltrVal, validate="key", validatecommand=(vcmd, '%P')).grid(column=3, row=r, sticky=(W, E)) r = r + 1 ttk.Label(menuFrame, text="Pointing").grid(column=1, row=r, sticky=W, columnspan=2) ttk.Entry(menuFrame, width=2, textvariable=pntVal, validate="key", validatecommand=(vcmd, '%P')).grid(column=3, row=r, sticky=(W, E)) r = r + 1 ttk.Label(menuFrame, text="Contact").grid(column=1, row=r, sticky=W, columnspan=2) ttk.Entry(menuFrame, width=2, textvariable=contVal, validate="key", validatecommand=(vcmd, '%P')).grid(column=3, row=r, sticky=(W, E)) r = r + 3 ttk.Button(menuFrame, text="Previous", command=lambda: loadFrame('d')).grid(column=1, row=r, sticky=E) ttk.Button(menuFrame, text="Run", command=lambda: runEkoMatching(conformerList, selConformers, conformerAtoms)).grid(column=6, row=r, sticky=W) for child in menuFrame.winfo_children(): child.grid_configure(padx=5, pady=5)
def settings_content(self): '''Add content to settings tab''' #Apply settings, undo settings to previously loaded, load/save preset. Apply and revert are greyed out until changes are made to settings #Buffer for aligning and centering buttons on bottom edge. grid() usage was unsuccesful. self.s_n_b = ttk.Frame(self.s_n) self.s_n_b.pack(side=tk.BOTTOM) self.b_apply = ttk.Button(self.s_n_b, text='Apply', command=self.apply_config) self.b_revert = ttk.Button(self.s_n_b, text='Revert Changes') self.b_load = ttk.Button(self.s_n_b, text='Load') # self.b_load['command'] = print ('apply settings()') self.b_save = ttk.Button(self.s_n_b, text='Save Settings') # self.b_save['command'] = print ('apply settings()') for i in (self.b_apply, self.b_revert, self.b_load, self.b_save): i.pack(side=tk.LEFT) #j.grid(column=i, row=1, sticky=tk.S) self.s_load = ttk.Frame(self.s_n) self.s_syn = ttk.Frame(self.s_n) self.s_cus = ttk.Frame(self.s_n) self.s_spd = ttk.Frame(self.s_n) self.s_dbg = ttk.Frame(self.s_n) self.s_n.add(self.s_load, text="Load data") self.s_n.add(self.s_syn, text="Synesthesia types") self.s_n.add(self.s_cus, text="Custom type") self.s_n.add(self.s_spd, text="Processing quality") self.s_n.add(self.s_dbg, text="Debugging") #Load file or select device for either audio or video, then reset parent's a/v/ processors self.s_vin = ttk.Button(self.s_load, text='Load video', command=self.select_video).grid(row=0, column=0, pady=16, padx=16) self.s_ain = ttk.Button(self.s_load, text='Load audio', command=self.select_audio).grid(row=1, column=0) self.s_av = ttk.Label( self.s_load, text='Fetch data from a device to use the microphone or camera' ).grid(row=2, column=0, pady=16, padx=16) self.use_vid_dev = True self.use_snd_dev = True self.s_vcheck = ttk.Checkbutton(self.s_load, text="Use video device", variable=self.use_vid_dev).grid( row=0, column=1) self.s_acheck = ttk.Checkbutton(self.s_load, text="Use audio device", variable=self.use_snd_dev).grid( row=1, column=1) #Synesthesia types. Default presets and recently saved presets #show current settings in label #show preset names, load them from file using Radio Buttons #show most recently saved preset #Align all elements in Synesthesia Types tab #Custom types: a lot of options. use FRAME LABELS, and scrolling #Select current visual artifact to edit # self.s_artifact = #canvas for current color #Check Button, overlay, contours, contour lines or filled, line width #add another audio band selector and color, canvas, check buttons #sensitivity Scale #Check Button motion detection? #Menu additive, subtractive, average compositing #Align all elements in Custom Types tab #Speed vs quality selectors #video resize factor #audio rates #Align all elements in Speed tab #Debug toggles self.s_d_aud = ttk.Checkbutton(self.s_dbg, text="Fetch audio", variable=self.s_audio).pack(pady=16) self.s_d_aud = ttk.Checkbutton(self.s_dbg, text="Detect motion", variable=self.s_motion).pack(pady=8) self.s_d_aud = ttk.Checkbutton(self.s_dbg, text="Calculate contours", variable=self.s_contours).pack(pady=8) self.s_d_aud = ttk.Checkbutton(self.s_dbg, text="Synesthesia overlay?", variable=self.s_syn_on).pack(pady=8) self.s_d_aud = ttk.Checkbutton(self.s_dbg, text="Show binary image", variable=self.s_binary).pack(pady=8) self.s_d_aud = ttk.Checkbutton(self.s_dbg, text="Show grayscale image", variable=self.s_gray).pack(pady=8)
def __init__(self, parent, title, app, manager, key=None, **kw): kw = self.initKw(kw) MfxDialog.__init__(self, parent, title, kw.resizable, kw.default) top_frame, bottom_frame = self.createFrames(kw) self.createBitmaps(top_frame, kw) # if key is None: key = manager.getSelected() self.manager = manager self.key = key self.app = app self.cardset_values = None # padx, pady = kw.padx, kw.pady padx, pady = 5, 5 if self.TreeDataHolder_Class.data is None: self.TreeDataHolder_Class.data = self.TreeData_Class(manager, key) # self.top.wm_minsize(400, 200) if self.top.winfo_screenwidth() >= 800: w1, w2 = 240, 400 else: w1, w2 = 200, 300 paned_window = ttk.PanedWindow(top_frame, orient='horizontal') paned_window.pack(expand=True, fill='both') left_frame = ttk.Frame(paned_window) right_frame = ttk.Frame(paned_window) paned_window.add(left_frame) paned_window.add(right_frame) font = app.getFont("default") self.tree = self.Tree_Class(self, left_frame, key=key, default=kw.default, font=font, width=w1) self.tree.frame.grid(row=0, column=0, sticky='nsew', padx=padx, pady=pady) if USE_PIL: # var = Tkinter.DoubleVar() var.set(app.opt.scale_x) self.scale_x = PysolScale(left_frame, label=_('Scale X:'), from_=0.5, to=4.0, resolution=0.1, orient='horizontal', variable=var, value=app.opt.scale_x, command=self._updateScale) self.scale_x.grid(row=1, column=0, sticky='ew', padx=padx, pady=pady) # var = Tkinter.DoubleVar() var.set(app.opt.scale_y) self.scale_y = PysolScale(left_frame, label=_('Scale Y:'), from_=0.5, to=4.0, resolution=0.1, orient='horizontal', variable=var, value=app.opt.scale_y, command=self._updateScale) self.scale_y.grid(row=2, column=0, sticky='ew', padx=padx, pady=pady) # self.auto_scale = Tkinter.BooleanVar() self.auto_scale.set(app.opt.auto_scale) check = ttk.Checkbutton(left_frame, text=_('Auto scaling'), variable=self.auto_scale, takefocus=False, command=self._updateAutoScale) check.grid(row=3, column=0, columnspan=2, sticky='ew', padx=padx, pady=pady) # self.preserve_aspect = Tkinter.BooleanVar() self.preserve_aspect.set(app.opt.preserve_aspect_ratio) self.aspect_check = ttk.Checkbutton( left_frame, text=_('Preserve aspect ratio'), variable=self.preserve_aspect, takefocus=False, # command=self._updateScale ) self.aspect_check.grid(row=4, column=0, sticky='ew', padx=padx, pady=pady) self._updateAutoScale() # left_frame.rowconfigure(0, weight=1) left_frame.columnconfigure(0, weight=1) # self.preview = MfxScrolledCanvas(right_frame, width=w2) self.preview.setTile(app, app.tabletile_index, force=True) self.preview.pack(fill='both', expand=True, padx=padx, pady=pady) self.preview.canvas.preview = 1 # create a preview of the current state self.preview_key = -1 self.preview_images = [] self.scale_images = [] self.updatePreview(key) # focus = self.createButtons(bottom_frame, kw) focus = self.tree.frame self.mainloop(focus, kw.timeout)
def trayectoria(): x_v = bl.control_P(4.0, odom_var.pose.pose.position.x, 0.1, 0.5, 0.2) enviar_velocidad(x_v, 0.0, 0.0, 0.0) print "Prueba " + str(x_v) if (x_v != 0.0): trayectoria() onevar = BooleanVar() onevar.set(False) one = ttk.Checkbutton(mainframe, text="Avanza", variable=onevar, onvalue=True, offvalue=False, command=prueba) one.grid(column=1, row=4) feet = StringVar() print(type(bl.conv_ang(45))) meters = str(bl.conv_ang(45)) feet_entry = ttk.Entry(mainframe, width=7, textvariable=feet) feet_entry.grid(column=2, row=1, sticky=(W, E)) #-------------- Despliegue datos de odometria y altura ------------------------- ttk.Label(mainframe, textvariable=x_odom).grid(column=1, row=2, sticky=(W, E)) ttk.Label(mainframe, textvariable=y_odom).grid(column=2, row=2, sticky=(W, E)) ttk.Label(mainframe, textvariable=z_odom).grid(column=3, row=2, sticky=(W, E)) ttk.Label(mainframe, textvariable=yaw_odom).grid(column=4, row=2,
def init_gui(self): self.frame_root = ttk.Frame(self.master, padding='5 2 5 2') self.canvas_a = tk.Canvas(self.frame_root) self.canvas_b = tk.Canvas(self.frame_root) self.cmd_list = scrolledtext.ScrolledText( self.frame_root, width=5, state='disable' ) self.frame_menu = ttk.Frame(self.frame_root) self.button_quit = ttk.Button( self.frame_menu, text='Quit', command=self.quit_from_app ) self.button_show_tips = ttk.Button( self.frame_menu, text='show tips', command=self.show_tips ) self.button_calc = ttk.Button( self.frame_menu, text='Calculate', command=self.calc ) self.button_speed_down = ttk.Button( self.frame_menu, text='<<', command=self.speed_down ) self.button_game = ttk.Button( self.frame_menu, text='▷', command=self.game ) self.button_speed_up = ttk.Button( self.frame_menu, text='>>', command=self.speed_up ) self.button_reset = ttk.Button( self.frame_menu, text='Reset', command=self.reset ) self.button_generate_new_data = ttk.Button( self.frame_menu, text='Generate new [a, b)', command=self.generate_new_data ) self.entry_range_a = ttk.Entry(self.frame_menu, width=10) self.entry_range_a.insert(0, str(game_info.DEFAULT_RANGE_A)) self.entry_range_b = ttk.Entry(self.frame_menu, width=10) self.entry_range_b.insert(0, str(game_info.DEFAULT_RANGE_B)) self.label_range_a = ttk.Label(self.frame_menu, text='<- input a') self.label_range_b = ttk.Label(self.frame_menu, text='<- input b') self.switch_builtin = ttk.Checkbutton( self.frame_menu, text='use built-in algo', command=self.builtin, variable=self.game_info.use_builtin ) self.label_file_name = ttk.Label( self.frame_menu, text='Custom push_swap:' ) self.entry_file_name = ttk.Entry( self.frame_menu, width=30, state=tk.DISABLED ) self.button_open_file = ttk.Button( self.frame_menu, text='choose file ...', command=self.choose_file, state=tk.DISABLED ) self.label_speed = ttk.Label(self.frame_menu) self.label_op_num = ttk.Label(self.frame_menu) self.label_curr_op = ttk.Label(self.frame_menu) self.label_stack_state = ttk.Label(self.frame_menu) self.label_poweredby = ttk.Label( self.frame_menu, text='powered by Ilya Kashnitkiy', anchor=tk.CENTER ) self.button_github = ttk.Button( self.frame_menu, command=self.github, text='github.com/elijahkash' ) self.button_like = ttk.Button( self.frame_menu, command=self.like, text='Like this app?' )
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 = '#b2c9f4' # Closest X11 color: 'SlateGray2' _ana1color = '#eaf4b2' # Closest X11 color: '{pale goldenrod}' _ana2color = '#f4bcb2' # Closest X11 color: 'RosyBrown2' font10 = "-family {DejaVu Sans Mono} -size 10 -weight normal " \ "-slant roman -underline 0 -overstrike 0" font9 = "-family {DejaVu Sans} -size 10 -weight normal -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=font9) self.style.map('.',background= [('selected', _compcolor), ('active',_ana2color)]) top.geometry("1037x654+329+175") top.title("Most Available Widgets") top.configure(highlightbackground="#f5deb3") top.configure(highlightcolor="black") self.Labelframe1 = LabelFrame(top) self.Labelframe1.place(relx=0.014, rely=0.076, relheight=0.313 , relwidth=0.145) self.Labelframe1.configure(relief=GROOVE) self.Labelframe1.configure(text='''Buttons''') self.Labelframe1.configure(highlightbackground="#f5deb3") self.Labelframe1.configure(width=150) self.Button1 = Button(self.Labelframe1) self.Button1.place(relx=0.133, rely=0.146, height=26, width=67 , bordermode='ignore') self.Button1.configure(activebackground="#d9d9d9") self.Button1.configure(disabledforeground="#b8a786") self.Button1.configure(highlightbackground="#f5deb3") self.Button1.configure(text='''Button''') self.Checkbutton1 = Checkbutton(self.Labelframe1) self.Checkbutton1.place(relx=0.2, rely=0.341, relheight=0.098 , relwidth=0.413, bordermode='ignore') self.Checkbutton1.configure(activebackground="#d9d9d9") self.Checkbutton1.configure(disabledforeground="#b8a786") self.Checkbutton1.configure(highlightbackground="#f5deb3") self.Checkbutton1.configure(justify=LEFT) self.Checkbutton1.configure(text='''Check''') self.Checkbutton1.configure(variable=lf_support.che42) self.Radiobutton1 = Radiobutton(self.Labelframe1) self.Radiobutton1.place(relx=0.333, rely=0.537, relheight=0.098 , relwidth=0.407, bordermode='ignore') self.Radiobutton1.configure(activebackground="#d9d9d9") self.Radiobutton1.configure(disabledforeground="#b8a786") self.Radiobutton1.configure(highlightbackground="#f5deb3") self.Radiobutton1.configure(justify=LEFT) self.Radiobutton1.configure(text='''Radio''') self.Radiobutton2 = Radiobutton(self.Labelframe1) self.Radiobutton2.place(relx=0.333, rely=0.634, relheight=0.098 , relwidth=0.407, bordermode='ignore') self.Radiobutton2.configure(activebackground="#d9d9d9") self.Radiobutton2.configure(disabledforeground="#b8a786") self.Radiobutton2.configure(highlightbackground="#f5deb3") self.Radiobutton2.configure(justify=LEFT) self.Radiobutton2.configure(text='''Radio''') self.Labelframe2 = LabelFrame(top) self.Labelframe2.place(relx=0.159, rely=0.084, relheight=0.313 , relwidth=0.145) self.Labelframe2.configure(relief=GROOVE) self.Labelframe2.configure(labelanchor="sw") self.Labelframe2.configure(text='''Labels''') self.Labelframe2.configure(highlightbackground="#f5deb3") self.Labelframe2.configure(width=150) self.Label1 = Label(self.Labelframe2) self.Label1.place(relx=0.133, rely=0.098, height=21, width=99 , bordermode='ignore') self.Label1.configure(activebackground="#f9f9f9") self.Label1.configure(disabledforeground="#b8a786") self.Label1.configure(highlightbackground="#f5deb3") self.Label1.configure(text='''Flat''') self.Label2 = Label(self.Labelframe2) self.Label2.place(relx=0.067, rely=0.244, height=21, width=119 , bordermode='ignore') self.Label2.configure(activebackground="#f9f9f9") self.Label2.configure(disabledforeground="#b8a786") self.Label2.configure(highlightbackground="#f5deb3") self.Label2.configure(relief=GROOVE) self.Label2.configure(text='''Groove''') self.Label3 = Label(self.Labelframe2) self.Label3.place(relx=0.067, rely=0.488, height=21, width=119 , bordermode='ignore') self.Label3.configure(activebackground="#f9f9f9") self.Label3.configure(disabledforeground="#b8a786") self.Label3.configure(highlightbackground="#f5deb3") self.Label3.configure(relief=RIDGE) self.Label3.configure(text='''Ridge''') self.Label4 = Label(self.Labelframe2) self.Label4.place(relx=0.067, rely=0.366, height=21, width=119 , bordermode='ignore') self.Label4.configure(activebackground="#f9f9f9") self.Label4.configure(disabledforeground="#b8a786") self.Label4.configure(highlightbackground="#f5deb3") self.Label4.configure(relief=RAISED) self.Label4.configure(text='''Raised''') self.Label5 = Label(self.Labelframe2) self.Label5.place(relx=0.067, rely=0.61, height=21, width=119 , bordermode='ignore') self.Label5.configure(activebackground="#f9f9f9") self.Label5.configure(disabledforeground="#b8a786") self.Label5.configure(highlightbackground="#f5deb3") self.Label5.configure(relief=SUNKEN) self.Label5.configure(text='''Sunken''') self.Message1 = Message(self.Labelframe2) self.Message1.place(relx=0.067, rely=0.78, relheight=0.122 , relwidth=0.813, bordermode='ignore') self.Message1.configure(highlightbackground="#f5deb3") self.Message1.configure(relief=RIDGE) self.Message1.configure(text='''Message''') self.Message1.configure(width=122) self.Labelframe3 = LabelFrame(top) self.Labelframe3.place(relx=0.304, rely=0.076, relheight=0.313 , relwidth=0.212) self.Labelframe3.configure(relief=GROOVE) self.Labelframe3.configure(text='''Text WIdgets''') self.Labelframe3.configure(highlightbackground="#f5deb3") self.Labelframe3.configure(width=220) self.Entry1 = Entry(self.Labelframe3) self.Entry1.place(relx=0.045, rely=0.244, height=21, relwidth=0.755 , bordermode='ignore') self.Entry1.configure(background="white") self.Entry1.configure(disabledforeground="#b8a786") self.Entry1.configure(font=font10) self.Entry1.configure(highlightbackground="#f5deb3") self.Entry1.configure(selectbackground="#c4c4c4") self.Text1 = Text(self.Labelframe3) self.Text1.place(relx=0.045, rely=0.585, relheight=0.361, relwidth=0.891 , bordermode='ignore') self.Text1.configure(background="white") self.Text1.configure(font=font9) self.Text1.configure(highlightbackground="#f5deb3") self.Text1.configure(selectbackground="#c4c4c4") self.Text1.configure(width=196) self.Text1.configure(wrap=WORD) self.Label6 = Label(self.Labelframe3) self.Label6.place(relx=0.045, rely=0.098, height=18, width=37 , bordermode='ignore') self.Label6.configure(activebackground="#f9f9f9") self.Label6.configure(disabledforeground="#b8a786") self.Label6.configure(highlightbackground="#f5deb3") self.Label6.configure(text='''Entry''') self.Label7 = Label(self.Labelframe3) self.Label7.place(relx=0.045, rely=0.439, height=18, width=52 , bordermode='ignore') self.Label7.configure(activebackground="#f9f9f9") self.Label7.configure(disabledforeground="#b8a786") self.Label7.configure(highlightbackground="#f5deb3") self.Label7.configure(text='''TextBox''') self.Labelframe4 = LabelFrame(top) self.Labelframe4.place(relx=0.516, rely=0.076, relheight=0.313 , relwidth=0.357) self.Labelframe4.configure(relief=GROOVE) self.Labelframe4.configure(text='''Other Widgets''') self.Labelframe4.configure(highlightbackground="#f5deb3") self.Labelframe4.configure(width=370) self.Listbox1 = Listbox(self.Labelframe4) self.Listbox1.place(relx=0.054, rely=0.244, relheight=0.332 , relwidth=0.227, bordermode='ignore') self.Listbox1.configure(background="white") self.Listbox1.configure(disabledforeground="#b8a786") self.Listbox1.configure(font=font10) self.Listbox1.configure(highlightbackground="#f5deb3") self.Listbox1.configure(selectbackground="#c4c4c4") self.Listbox1.configure(width=10) self.Scale1 = Scale(self.Labelframe4) self.Scale1.place(relx=0.324, rely=0.146, relwidth=0.0, relheight=0.507 , width=49, bordermode='ignore') self.Scale1.configure(activebackground="#d9d9d9") self.Scale1.configure(font=font9) self.Scale1.configure(highlightbackground="#f5deb3") self.Scale1.configure(troughcolor="#d9d9d9") self.Scale2 = Scale(self.Labelframe4) self.Scale2.place(relx=0.514, rely=0.293, relwidth=0.281, relheight=0.0 , height=40, bordermode='ignore') self.Scale2.configure(activebackground="#d9d9d9") self.Scale2.configure(font=font9) self.Scale2.configure(highlightbackground="#f5deb3") self.Scale2.configure(orient="horizontal") self.Scale2.configure(troughcolor="#d9d9d9") self.Spinbox1 = Spinbox(self.Labelframe4, from_=1.0, to=100.0) self.Spinbox1.place(relx=0.081, rely=0.78, relheight=0.102 , relwidth=0.481, bordermode='ignore') self.Spinbox1.configure(activebackground="#f9f9f9") self.Spinbox1.configure(background="white") self.Spinbox1.configure(buttonbackground="#f5deb3") self.Spinbox1.configure(disabledforeground="#b8a786") self.Spinbox1.configure(font=font9) self.Spinbox1.configure(from_="1.0") self.Spinbox1.configure(highlightbackground="black") self.Spinbox1.configure(selectbackground="#c4c4c4") self.Spinbox1.configure(textvariable=lf_support.spinbox) self.Spinbox1.configure(to="100.0") self.Label8 = Label(self.Labelframe4) self.Label8.place(relx=0.541, rely=0.195, height=18, width=89 , bordermode='ignore') self.Label8.configure(activebackground="#f9f9f9") self.Label8.configure(disabledforeground="#b8a786") self.Label8.configure(highlightbackground="#f5deb3") self.Label8.configure(text='''Scale Widgets''') self.Label9 = Label(self.Labelframe4) self.Label9.place(relx=0.081, rely=0.634, height=18, width=53 , bordermode='ignore') self.Label9.configure(activebackground="#f9f9f9") self.Label9.configure(disabledforeground="#b8a786") self.Label9.configure(highlightbackground="#f5deb3") self.Label9.configure(text='''SpinBox''') self.Label10 = Label(self.Labelframe4) self.Label10.place(relx=0.054, rely=0.122, height=21, width=52 , bordermode='ignore') self.Label10.configure(activebackground="#f9f9f9") self.Label10.configure(disabledforeground="#b8a786") self.Label10.configure(highlightbackground="#f5deb3") self.Label10.configure(text='''ListBox''') self.TSeparator1 = ttk.Separator(top) self.TSeparator1.place(relx=0.01, rely=0.413, relwidth=0.974) self.Label11 = Label(top) self.Label11.place(relx=0.029, rely=0.428, height=18, width=106) self.Label11.configure(activebackground="#f9f9f9") self.Label11.configure(disabledforeground="#b8a786") self.Label11.configure(highlightbackground="#f5deb3") self.Label11.configure(text='''Themed Widgets''') self.Label12 = Label(top) self.Label12.place(relx=0.019, rely=0.031, height=18, width=125) self.Label12.configure(activebackground="#f9f9f9") self.Label12.configure(disabledforeground="#b8a786") self.Label12.configure(highlightbackground="#f5deb3") self.Label12.configure(text='''"Standard" Widgets''') self.TLabelframe1 = ttk.Labelframe(top) self.TLabelframe1.place(relx=0.029, rely=0.489, relheight=0.39 , relwidth=0.193) self.TLabelframe1.configure(text='''TButtons''') self.TLabelframe1.configure(width=200) self.TButton1 = ttk.Button(self.TLabelframe1) self.TButton1.place(relx=0.1, rely=0.118, height=26, width=83 , bordermode='ignore') self.TButton1.configure(takefocus="") self.TButton1.configure(text='''Tbutton''') self.style.map('TCheckbutton',background= [('selected', _bgcolor), ('active', _ana2color)]) self.TCheckbutton1 = ttk.Checkbutton(self.TLabelframe1) self.TCheckbutton1.place(relx=0.25, rely=0.275, relwidth=0.32 , relheight=0.0, height=19, bordermode='ignore') self.TCheckbutton1.configure(variable=lf_support.tch70) self.TCheckbutton1.configure(takefocus="") self.TCheckbutton1.configure(text='''Tcheck''') self.style.map('TRadiobutton',background= [('selected', _bgcolor), ('active', _ana2color)]) self.TRadiobutton1 = ttk.Radiobutton(self.TLabelframe1) self.TRadiobutton1.place(relx=0.55, rely=0.392, relwidth=0.33 , relheight=0.0, height=19, bordermode='ignore') self.TRadiobutton1.configure(takefocus="") self.TRadiobutton1.configure(text='''TRadio''') self.TRadiobutton2 = ttk.Radiobutton(self.TLabelframe1) self.TRadiobutton2.place(relx=0.55, rely=0.471, relwidth=0.33 , relheight=0.0, height=19, bordermode='ignore') self.TRadiobutton2.configure(takefocus="") self.TRadiobutton2.configure(text='''TRadio''') self.TLabelframe2 = ttk.Labelframe(top) self.TLabelframe2.place(relx=0.222, rely=0.497, relheight=0.39 , relwidth=0.193) self.TLabelframe2.configure(labelanchor="s") self.TLabelframe2.configure(text='''TComboBox''') self.TLabelframe2.configure(width=200) self.TCombobox1 = ttk.Combobox(self.TLabelframe2) self.TCombobox1.place(relx=0.1, rely=0.118, relheight=0.082 , relwidth=0.735, bordermode='ignore') self.TCombobox1.configure(textvariable=lf_support.combobox) self.TCombobox1.configure(takefocus="") self.TLabelframe3 = ttk.Labelframe(top) self.TLabelframe3.place(relx=0.415, rely=0.489, relheight=0.39 , relwidth=0.231) self.TLabelframe3.configure(text='''Tlabelframe''') self.TLabelframe3.configure(width=240) self.TEntry1 = ttk.Entry(self.TLabelframe3) self.TEntry1.place(relx=0.125, rely=0.196, relheight=0.071 , relwidth=0.683, bordermode='ignore') self.TEntry1.configure(takefocus="") self.TEntry1.configure(cursor="xterm") self.TProgressbar1 = ttk.Progressbar(self.TLabelframe3) self.TProgressbar1.place(relx=0.125, rely=0.392, relwidth=0.417 , relheight=0.0, height=19, bordermode='ignore') self.TScale1 = ttk.Scale(self.TLabelframe3) self.TScale1.place(relx=0.042, rely=0.51, relwidth=0.0, relheight=0.392 , width=17, bordermode='ignore') self.TScale1.configure(orient="vertical") self.TScale1.configure(takefocus="") self.TScale2 = ttk.Scale(self.TLabelframe3) self.TScale2.place(relx=0.167, rely=0.824, relwidth=0.417, relheight=0.0 , height=17, bordermode='ignore') self.TScale2.configure(takefocus="") self.TLabel1 = ttk.Label(self.TLabelframe3) self.TLabel1.place(relx=0.167, rely=0.588, height=16, width=41 , bordermode='ignore') self.TLabel1.configure(background="#d9d9d9") self.TLabel1.configure(foreground="#000000") self.TLabel1.configure(font="TkDefaultFont") self.TLabel1.configure(relief=FLAT) self.TLabel1.configure(text='''TScale''') self.TLabel2 = ttk.Label(self.TLabelframe3) self.TLabel2.place(relx=0.125, rely=0.314, height=16, width=80 , bordermode='ignore') self.TLabel2.configure(background="#d9d9d9") self.TLabel2.configure(foreground="#000000") self.TLabel2.configure(font="TkDefaultFont") self.TLabel2.configure(relief=FLAT) self.TLabel2.configure(text='''TProgressBar''') self.TLabel3 = ttk.Label(self.TLabelframe3) self.TLabel3.place(relx=0.083, rely=0.078, height=16, width=42 , bordermode='ignore') self.TLabel3.configure(background="#d9d9d9") self.TLabel3.configure(foreground="#000000") self.TLabel3.configure(font="TkDefaultFont") self.TLabel3.configure(relief=FLAT) self.TLabel3.configure(text='''TEntry''') self.TFrame1 = ttk.Frame(top) self.TFrame1.place(relx=0.646, rely=0.497, relheight=0.372 , relwidth=0.333) self.TFrame1.configure(relief=GROOVE) self.TFrame1.configure(borderwidth="2") self.TFrame1.configure(relief=GROOVE) self.TFrame1.configure(width=345) self.style.configure('TNotebook.Tab', background=_bgcolor) self.style.configure('TNotebook.Tab', foreground=_fgcolor) self.style.map('TNotebook.Tab', background= [('selected', _compcolor), ('active',_ana2color)]) self.TNotebook1 = ttk.Notebook(self.TFrame1) self.TNotebook1.place(relx=0.029, rely=0.041, relheight=0.926 , relwidth=0.942) self.TNotebook1.configure(width=325) self.TNotebook1.configure(takefocus="") self.TNotebook1_t0 = Frame(self.TNotebook1) self.TNotebook1.add(self.TNotebook1_t0, padding=3) self.TNotebook1.tab(0, text="Page 1",compound="left",underline="-1",) self.TNotebook1_t0.configure(highlightbackground="#f5deb3") self.TNotebook1_t1 = Frame(self.TNotebook1) self.TNotebook1.add(self.TNotebook1_t1, padding=3) self.TNotebook1.tab(1, text="Page 2",compound="left",underline="-1",) self.TNotebook1_t1.configure(highlightbackground="#f5deb3") self.Button2 = Button(top) self.Button2.place(relx=0.405, rely=0.902, height=27, width=69) self.Button2.configure(activebackground="#d9d9d9") self.Button2.configure(command=lf_support.quit) self.Button2.configure(disabledforeground="#b8a786") self.Button2.configure(font=font9) self.Button2.configure(highlightbackground="#f5deb3") self.Button2.configure(text='''Quit''')
def add_plot_argument_entries(self): self.vertex_label_size = Tkinter.StringVar(self.root) self.add_entry_with_label( 'vertex label size', 5, 5, self.vertex_label_size, 180 ) self.vertex_shape = Tkinter.StringVar(self.root) vertex_shape_choices = [ 'circle', 'rectangle', 'hidden', 'triangle-up', 'triangle-down' ] self.add_optionmenu_with_label( 'vertex shape', 5, 35, self.vertex_shape, vertex_shape_choices, 180 ) self.vertex_size = Tkinter.StringVar(self.root) self.add_entry_with_label( 'vertex size', 5, 65, self.vertex_size, 180 ) self.vertex_label_angle = Tkinter.StringVar(self.root) self.add_entry_with_label( 'vertex label angle (radians)', 5, 95, self.vertex_label_angle, 180 ) self.vertex_label_distance = Tkinter.StringVar(self.root) self.add_entry_with_label( 'vertex label distance', 5, 125, self.vertex_label_distance, 180 ) self.edge_curvature = Tkinter.StringVar(self.root) self.add_entry_with_label( 'edge curvature', 5, 155, self.edge_curvature, 180 ) self.edge_width = Tkinter.StringVar(self.root) self.add_entry_with_label( 'edge width', 5, 185, self.edge_width, 180 ) self.arrow_size = Tkinter.StringVar(self.root) self.add_entry_with_label( 'arrow size', 5, 215, self.arrow_size, 180 ) self.arrow_width = Tkinter.StringVar(self.root) self.add_entry_with_label( 'arrow width', 5, 245, self.arrow_width, 180 ) self.layout = Tkinter.StringVar(self.root) layout_choices = [ 'kk', 'circle', 'drl', 'fr', 'fr3d', 'grid_fr', 'kk3d', 'large_graph', 'random', 'random_3d', 'rt', 'rt_circular', 'sphere' ] self.add_optionmenu_with_label( 'plot layout', 5, 275, self.layout, layout_choices, 180 ) self.pixel_width = Tkinter.StringVar(self.root) self.add_entry_with_label( 'plot width (pixels)', 5, 305, self.pixel_width, 180 ) self.pixel_height = Tkinter.StringVar(self.root) self.add_entry_with_label( 'plot height (pixels)', 5, 335, self.pixel_height, 180 ) self.top_margin = Tkinter.StringVar(self.root) self.add_entry_with_label( 'top margin (pixels)', 5, 365, self.top_margin, 180 ) self.bottom_margin = Tkinter.StringVar(self.root) self.add_entry_with_label( 'bottom margin (pixels)', 5, 395, self.bottom_margin, 180 ) self.right_margin = Tkinter.StringVar(self.root) self.add_entry_with_label( 'right margin (pixels)', 5, 425, self.right_margin, 180 ) self.left_margin = Tkinter.StringVar(self.root) self.add_entry_with_label( 'left margin (pixels)', 5, 455, self.left_margin, 180 ) self.edge_red = Tkinter.StringVar(self.root) self.edge_green = Tkinter.StringVar(self.root) self.edge_blue = Tkinter.StringVar(self.root) self.add_rgb_entries_with_label( 'edge color', 5, 485, self.edge_red, self.edge_green, self.edge_blue, 180 ) self.vertex_red = Tkinter.StringVar(self.root) self.vertex_green = Tkinter.StringVar(self.root) self.vertex_blue = Tkinter.StringVar(self.root) self.add_rgb_entries_with_label( 'vertex color', 5, 575, self.vertex_red, self.vertex_green, self.vertex_blue, 180 ) self.remove_duplicate_edges = Tkinter.IntVar(self.root) self.remove_duplicate_edges.set(0) self.remove_duplicate_edges_checkbutton = ttk.Checkbutton( self, text = "remove duplicate edges", variable = self.remove_duplicate_edges, onvalue = 1, offvalue = 0 ) self.remove_duplicate_edges_checkbutton.place(x = 5, y = 665)
borderwidth=5, relief="sunken", width=200, height=100) namelbl = ttk.Label(root, text="Name") name = ttk.Entry(content) onevar = BooleanVar() twovar = BooleanVar() threevar = BooleanVar() onevar.set(True) twovar.set(False) threevar.set(True) one = ttk.Checkbutton(content, text="One", variable=onevar, onvalue=True) two = ttk.Checkbutton(content, text="Two", variable=twovar, onvalue=True) three = ttk.Checkbutton(content, text="Three", variable=threevar, onvalue=True) ok = ttk.Button(content, text="Okay") cancel = ttk.Button(content, text="Cancel") content.grid(column=0, row=0, sticky=(N, S, E, W)) frame.grid(column=0, row=0, columnspan=3, rowspan=2, sticky=(N, S, E, W)) namelbl.grid(column=3, row=0, columnspan=2, sticky=(N, W), padx=5) name.grid(column=3, row=1, columnspan=2, sticky=(N, E, W), pady=5, padx=5) one.grid(column=0, row=3) two.grid(column=1, row=3) three.grid(column=2, row=3) ok.grid(column=3, row=3) cancel.grid(column=4, row=3)
def CreateConfig(sw_config, top): global init_height global circular top.geometry("500x" + str(init_height) + "+1+1") global no_config global r_config ''' if no_config > 15: return ''' label0 = ttk.Label(sw_config, text="Configuration " + str(no_config - r_config)) lebi_a.append(label0) label0.grid(row=no_config - 1, column=0) fm1 = Frame(sw_config) label1 = ttk.Label(fm1, text="Static Analysis").pack(side=TOP) measureSystem1 = IntVar() measureSystem2 = IntVar() measureSystem3 = IntVar() check1 = ttk.Checkbutton(fm1, text='Cpp Check', variable=measureSystem1, onvalue=1, offvalue=0).pack(side=LEFT) check2 = ttk.Checkbutton(fm1, text='Infer', variable=measureSystem2, onvalue=1, offvalue=0).pack(side=LEFT) check3 = ttk.Checkbutton(fm1, text='Coverity', variable=measureSystem3, onvalue=1, offvalue=0).pack(side=LEFT) cheki_s.append(measureSystem1) cheki_s.append(measureSystem2) cheki_s.append(measureSystem3) fm1.grid(row=no_config, column=1) frami_a.append(fm1) fm20 = Frame(sw_config) label1 = ttk.Label(fm20, text="").pack(side=TOP) fm20.grid(row=no_config, column=3) frami_a.append(fm20) fm2 = Frame(sw_config) label1 = ttk.Label(fm2, text="Verification").pack(side=TOP) e3 = ttk.Combobox(fm2, width="10") e3.pack() e3['values'] = ['cbmc', 'spin', 'none'] e3.current(0) combi_v.append(e3) fm2.grid(row=no_config, column=5) frami_a.append(fm2) fm40 = Frame(sw_config) label1 = ttk.Label(fm40, text="").pack(side=TOP) fm40.grid(row=no_config + 1, column=7) frami_a.append(fm40) fm3 = Frame(sw_config) label1 = ttk.Label(fm3, text="WP").pack(side=TOP) e4 = ttk.Combobox(fm3, width="10") e4.pack() e4['values'] = ['frama-c', 'none'] e4.current(0) combi_w.append(e4) fm3.grid(row=no_config, column=9) frami_a.append(fm3) fm4 = Frame(sw_config) label1 = ttk.Label(fm4, text="").pack(side=TOP) fm4.grid(row=no_config + 1, column=0) frami_a.append(fm4) no_config += 3 r_config += 2 circular += 1 init_height = init_height + 70 + circular
def show_settings_frequency_band(self, frequencyBandSettings=None): if self.settings_sreen == None: self.create_settings_screen( VisualisationTypes.FREQUENCY_BAND, 300, 275 + 21 * (len(FrequencyBands.values) - 1)) titleChannels = tk.Label(self.settings_sreen, text="Displayed channels:") titleChannels.pack(anchor=NW, padx=20, pady=10) frame1 = tk.Frame(self.settings_sreen) frame1.pack(side="top", fill="x", padx=20) checkLeft = ttk.Checkbutton( self.settings_sreen, text=ChannelTypes.LEFT, variable=frequencyBandSettings.channel[ChannelTypes.LEFT]) checkLeft.pack(in_=frame1, side=LEFT) checkRight = ttk.Checkbutton( self.settings_sreen, text=ChannelTypes.RIGHT, variable=frequencyBandSettings.channel[ChannelTypes.RIGHT]) checkRight.pack(in_=frame1, side=LEFT, padx=37) frame2 = ttk.Frame(self.settings_sreen) frame2.pack(side="top", fill="x", padx=20) checkFront = ttk.Checkbutton( self.settings_sreen, text=ChannelTypes.MID, variable=frequencyBandSettings.channel[ChannelTypes.MID]) checkFront.pack(in_=frame2, side=LEFT) checkBack = ttk.Checkbutton( self.settings_sreen, text=ChannelTypes.BACK, variable=frequencyBandSettings.channel[ChannelTypes.BACK]) checkBack.pack(in_=frame2, side=LEFT, padx=20) titleLabels = tk.Label(self.settings_sreen, text="Display settings:") titleLabels.pack(anchor=NW, padx=20, pady=10) frame3 = ttk.Frame(self.settings_sreen) frame3.pack(side="top", fill="x", padx=20) checkLabels = ttk.Checkbutton( self.settings_sreen, text='Show labels on plot', variable=frequencyBandSettings.showLabels) checkLabels.pack(in_=frame3, side=LEFT) titleFreqBand = tk.Label(self.settings_sreen, text="Select frequency band:") titleFreqBand.pack(anchor=NW, padx=20, pady=10) for band in FrequencyBands.values: b = ttk.Radiobutton( self.settings_sreen, text=band, variable=frequencyBandSettings.frequencyBand, value=band) b.pack(anchor=NW, padx=20) buttonFrame = ttk.Frame(self.settings_sreen) buttonFrame.pack(anchor=SE, fill="x", padx=20, pady=20) button = ttk.Button(self.settings_sreen, text="Cancel", command=self.remove_settings_screen) button.pack(in_=buttonFrame, side=RIGHT) button = ttk.Button(self.settings_sreen, text="Ok", command=partial(self.save_settings_screen, frequencyBandSettings)) button.pack(in_=buttonFrame, side=RIGHT, padx=10) else: if self.settings_sreen.type == VisualisationTypes.FREQUENCY_BAND: self.settings_sreen.focus() else: self.remove_settings_screen() self.show_settings_frequency_band(frequencyBandSettings)
def __init__(self, root, row, deleteButton = None): self.vars = {} widgets = [] pady = 10 padx = 3 #day of the week for i in range(0, 7): w = 'w'+str(i) self.vars[w] = IntVar() t = ttk.Checkbutton(root, variable = self.vars[w]) t.grid(column = i+1, row = row, pady = (pady, 0), sticky = 'ew') widgets.append(t) if not deleteButton: self.vars[w].set(1) t.config(state = 'disable') #time from self.vars['fromHr'] = StringVar() t = ttk.Entry(root, width=2, textvariable = self.vars['fromHr']) t.grid(column = 8, row = row, padx = (padx, 0), pady = (pady, 0)) widgets.append(t) t = ttk.Label(root, text = ":") t.grid(column = 9, row = row, pady = (pady, 0)) widgets.append(t) self.vars['fromMin'] = StringVar() t = ttk.Entry(root, width=2, textvariable = self.vars['fromMin']) t.grid(column = 10, row = row, padx = (0, padx), pady = (pady, 0)) widgets.append(t) #time to self.vars['toHr'] = StringVar() t = ttk.Entry(root, width=2, textvariable = self.vars['toHr']) t.grid(column = 11, row = row, padx = (padx, 0), pady = (pady, 0)) widgets.append(t) t = ttk.Label(root, text = ":") t.grid(column = 12, row = row, pady = (pady, 0)) widgets.append(t) self.vars['toMin'] = StringVar() t = ttk.Entry(root, width=2, textvariable = self.vars['toMin']) t.grid(column = 13, row = row, padx = (0, padx), pady = (pady, 0)) widgets.append(t) if not deleteButton: self.vars['fromHr'].set('00') self.vars['fromMin'].set('00') self.vars['toHr'].set('00') self.vars['toMin'].set('00') widgets[-1].config(state = 'disable') widgets[-3].config(state = 'disable') widgets[-4].config(state = 'disable') widgets[-6].config(state = 'disable') #events self.vars['door'] = IntVar(value = 0 if deleteButton else 1) t = ttk.Checkbutton(root, variable = self.vars['door']) t.grid(column = 14, row = row, padx = (padx, 0), pady = (pady, 0)) widgets.append(t) self.vars['move'] = IntVar(value = 0 if deleteButton else 1) t = ttk.Checkbutton(root, variable = self.vars['move']) t.grid(column = 15, row = row, pady = (pady, 0)) widgets.append(t) self.vars['light'] = IntVar(value = 0 if deleteButton else 1) t = ttk.Checkbutton(root, variable = self.vars['light']) t.grid(column = 16, row = row, padx = (0, padx), pady = (pady, 0)) widgets.append(t) #actions self.vars['sms'] = IntVar(value = 0 if deleteButton else 1) t = ttk.Checkbutton(root, variable = self.vars['sms']) t.grid(column = 17, row = row, padx = (padx, 0), pady = (pady, 0)) widgets.append(t) self.vars['call'] = IntVar(value = 0 if deleteButton else 1) t = ttk.Checkbutton(root, variable = self.vars['call']) t.grid(column = 18, row = row, pady = (pady, 0)) widgets.append(t) self.vars['buzz'] = IntVar(value = 0 if deleteButton else 1) t = ttk.Checkbutton(root, variable = self.vars['buzz']) t.grid(column = 19, row = row, padx = (0, padx), pady = (pady, 0)) widgets.append(t) #delete entry if deleteButton: self.deleteButton = deleteButton t = ttk.Button(root, text = "X", width = 3, command = lambda: self.delete()) t.grid(column = 20, row = row, padx = padx, pady = (pady, 0)) widgets.append(t) self.widgets = widgets
def __init__(self, mainwindow, defect_study): tk.Toplevel.__init__(self, mainwindow) self.resizable(False, False) self.mainwindow = mainwindow self.project = self.mainwindow.projects[ self.mainwindow.currentprojectid] self.fpp = defect_study.fpp self.main_frame = ttk.Frame(self) self.main_frame.pack(expand=True, fill='both') self.main_frame.grid_columnconfigure(0, weight=1) self.title(defect_study.treetitle + ' Formation Energy Plot Parameters Edition Window') # ---------------------------------------------- FPP PARAMS ------------------------------------------------ self.label0 = tk.Label( self.main_frame, text='Formation Energy Plot Specific Parameters', font='-weight bold') self.fpp_param_frame = ttk.LabelFrame(self.main_frame, labelwidget=self.label0) self.fpp_param_frame.grid(sticky='nsew') self.display_transition_levels_var = tk.BooleanVar( value=self.fpp.display_transition_levels) ttk.Checkbutton(self.fpp_param_frame, text='Display Transition Levels', variable=self.display_transition_levels_var, onvalue=True, offvalue=False).grid(row=0, column=1, sticky=W) self.display_charges_var = tk.BooleanVar( value=self.fpp.display_charges) ttk.Checkbutton(self.fpp_param_frame, text='Display Charges', variable=self.display_charges_var, onvalue=True, offvalue=False).grid(row=1, column=1, sticky=W) # ---------------------------------------------- DISPLAY PARAMS ------------------------------------------------ self.display_param = tu.DisplayParametersFrame(self.main_frame, 'Position in the gap', 'Formation energy', self.fpp) self.display_param.frame.grid(row=2, column=0, pady=3, sticky='nsew') # --------------------------------------------------- BUTTONS -------------------------------------------------- buttons_frame = ttk.Frame(self.main_frame) buttons_frame.grid(row=3, column=0, pady=3, sticky='nsew') ttk.Button(buttons_frame, text='Apply', command=self.save).grid(row=0, column=0, padx=5) ttk.Button(buttons_frame, text='OK', command=lambda: self.save(close=True)).grid(row=0, column=1, padx=5) ttk.Button(buttons_frame, text='Cancel', command=self.destroy).grid(row=0, column=2, padx=5)
def makeMainSettings(self, root): mainConfFrame = ttk.LabelFrame(root, text = Local('Alarms')) mainConfFrame.pack(side = 'top', fill = 'x', padx = 3, pady = 3) #phone number phoneFrame = ttk.Frame(mainConfFrame) phoneFrame.pack(side = 'top', padx = 3, pady = 3, anchor="w") ttk.Label(phoneFrame, text = Local('Tel.')).pack(side = 'left', padx = 3, pady = 3) self.phone = StringVar(value = '+12225566123') ttk.Entry(phoneFrame, width=20, textvariable=self.phone).pack(side = 'left', padx = 3, pady = 3) #Max one report in 20min maxOneRepFrame = ttk.Frame(mainConfFrame) maxOneRepFrame.pack(side = 'top', padx = 3, pady = 3, anchor="w") self.maxOneRepOn = IntVar(value = 0) ttk.Checkbutton(maxOneRepFrame, text = Local('Max one report in 20min'), variable=self.maxOneRepOn).pack(side = 'left', padx = 3, pady = 3) #daily report time dRepFrame = ttk.Frame(mainConfFrame) dRepFrame.pack(side = 'top', padx = 3, pady = 3, anchor="w") self.repOn = IntVar(value = 1) ttk.Checkbutton(dRepFrame, text = Local('Daily report'), variable=self.repOn).pack(side = 'left', padx = 3, pady = 3) self.repOn.trace('w', lambda *args: drepEn(self.repOn.get())) self.repHr = StringVar(value = '20') rm = ttk.Entry(dRepFrame, width=2, textvariable=self.repHr) rm.pack(side = 'left') ttk.Label(dRepFrame, text = ":").pack(side = 'left') self.repMin = StringVar(value = '00') rh = ttk.Entry(dRepFrame, width=2, textvariable=self.repMin) rh.pack(side = 'left') def drepEn(v): if v: rm.config(state='enabled') rh.config(state='enabled') else: rm.config(state='disabled') rh.config(state='disabled') #temperature report tempFrame = ttk.Frame(mainConfFrame) tempFrame.pack(side = 'top', padx = 3, pady = 3, anchor="w") self.tempRepOn = IntVar(value = 1) ttk.Checkbutton(tempFrame, text = Local('Temperature alarm'), variable=self.tempRepOn).pack(side = 'left', padx = 3, pady = 3) self.tempRepOn.trace('w', lambda *args: trepEn(self.tempRepOn.get())) #ttk.Label(tempFrame, text = Local('Temperature alarm')).pack(side = 'top', padx = 3, pady = 3) ttk.Label(tempFrame, text = Local('min.')).pack(side = 'left') self.tempMin = StringVar(value = '-30') tmin = ttk.Entry(tempFrame, width=4, textvariable=self.tempMin) tmin.pack(side = 'left') ttk.Label(tempFrame, text = "°С " + Local('max.')).pack(side = 'left') self.tempMax = StringVar(value = '40') tmax = ttk.Entry(tempFrame, width=4, textvariable=self.tempMax) tmax.pack(side = 'left') ttk.Label(tempFrame, text = "°С").pack(side = 'left') def trepEn(v): if v: tmin.config(state='enabled') tmax.config(state='enabled') else: tmin.config(state='disabled') tmax.config(state='disabled')
def __init__(self, mainwindow, material_study): tk.Toplevel.__init__(self, mainwindow) self.mainwindow = mainwindow self.material_study = material_study self.cpp = material_study.cpp self.main_frame = ttk.Frame(self) self.main_frame.grid(sticky='nsew') self.main_frame.grid_columnconfigure(0, weight=1) self.title(material_study.treetitle + ' Defect Concentrations Plot Parameters Window') # --------------------------------------------- EFFECTIVE MASSE -------------------------------------------------- label0 = tk.Label(self.main_frame, text='Charge Carriers Effective Masses', font='-weight bold') masses_frame = ttk.LabelFrame(self.main_frame, labelwidget=label0) masses_frame.grid(sticky='nsew') self.m_e_entry = tu.QuantityEntry(masses_frame, 'Electrons effective mass', self.cpp.m_e, ' me', width=5) self.m_e_entry.pack(padx=5, pady=5) self.m_h_entry = tu.QuantityEntry(masses_frame, 'Holes effective mass', self.cpp.m_h, ' me', width=5) self.m_h_entry.pack(padx=5, pady=5) # --------------------------------------------- TEMPERATURES -------------------------------------------------- label1 = tk.Label(self.main_frame, text='Temperatures', font='-weight bold') temperature_frame = ttk.LabelFrame(self.main_frame, labelwidget=label1) temperature_frame.grid() tk.Label(temperature_frame, text='Ambiant Temperature (fixed) ').grid(row=0, column=0) self.cte_temp = tu.QuantityEntry(temperature_frame, '', self.cpp.temperature, 'K', width=7) self.cte_temp.grid(row=0, column=1) self.temp_range = tu.RangeFrame(temperature_frame, self.cpp.xmin, self.cpp.xmax, 'Growth Temperature', 'K', step=self.cpp.dt, width=7) self.temp_range.grid(row=1, column=0, columnspan=2, pady=5, padx=5) # --------------------------------------------- SPECIFIC OPTIONS -------------------------------------------------- self.charge_carriers_var = tk.BooleanVar( value=self.cpp.charge_carriers) self.fill_type_var = tk.IntVar(value=self.cpp.fill_type) label11 = tk.Label(self.main_frame, text='Specific options', font='-weight bold') options_frame = ttk.LabelFrame(self.main_frame, labelwidget=label11) options_frame.grid(sticky='nsew') # Display charge carriers ttk.Checkbutton( options_frame, text='Display charge carriers concentrations ', variable=self.charge_carriers_var, command=self.set_display_charge_carriers).pack(side='left') # Fill conductivity type ttk.Checkbutton(options_frame, text='Fill conductivity type ', variable=self.fill_type_var, command=self.set_fill_type).pack(side='left') # ---------------------------------------------- DISPLAY PARAMS ------------------------------------------------ self.display_param = tu.DisplayParametersFrame( self.main_frame, 'Growth Temperature', 'Defect Concentrations', self.cpp) self.display_param.frame.grid(row=3, column=0, pady=3, sticky='nsew') # ---------------------------------------------- COLORS ------------------------------------------------ self.label2 = tk.Label(self.main_frame, text='Colors', font='-weight bold') self.colors_pane = ttk.LabelFrame(self.main_frame, labelwidget=self.label2) self.colors = {} self.labels = {} self.index = 0 def title(key): if key in ['n (electrons)', 'n (holes)', 'n type', 'p type']: return key else: return self.material_study.defect_studies[key].treetitle sort_list = [[key, title(key)] for key in self.cpp.colors.keys()] sort_list.sort(key=lambda x: x[1]) for key, treetitle in sort_list: if key in self.cpp.data_id or (key in ['n type', 'p type'] and self.cpp.fill_type): self.colors[key] = tk.Button( self.colors_pane, text='\t\t', bg=self.cpp.colors[key], command=lambda port=key: self.set_color(port)) self.colors[key].grid(row=self.index, column=0, sticky='w') self.labels[key] = tk.Label(self.colors_pane, text=treetitle) self.labels[key].grid(row=self.index, column=1, sticky='w') self.index += 1 self.colors_pane.grid(row=4, column=0, pady=3, sticky='nsew') # --------------------------------------------------- BUTTONS -------------------------------------------------- buttons_frame = ttk.Frame(self.main_frame) buttons_frame.grid(row=5, column=0, pady=3, sticky='nsew') ttk.Button(buttons_frame, text='Apply', command=self.save).grid(row=0, column=0, padx=5) ttk.Button(buttons_frame, text='OK', command=lambda: self.save(close=True)).grid(row=0, column=1, padx=5) ttk.Button(buttons_frame, text='Cancel', command=self.destroy).grid(row=0, column=2, padx=5)
def __init__(self, master=None): self.master=master style = ttk.Style() theme = style.theme_use() default = style.lookup(theme, 'background') master.configure(background=default) self.TLabelframe1 = ttk.Labelframe (master) self.TLabelframe1.place(relx=0.02,rely=0.07,relheight=0.63 ,relwidth=0.96) self.TLabelframe1.configure(text='''Specify the parameters for data to be converted to KML''') self.TLabel1 = ttk.Label (self.TLabelframe1) self.TLabel1.place(relx=0.03,rely=0.58,height=19,width=128) self.TLabel1.configure(relief="flat") self.TLabel1.configure(text='''X / Easting / Longitude:''') self.TCombobox1 = ttk.Combobox (self.TLabelframe1, state='readonly') self.TCombobox1.place(relx=0.42,rely=0.25,relheight=0.08,relwidth=0.55) self.TCombobox1.configure(textvariable=combobox) self.TCombobox1.configure(takefocus="") self.TCombobox1.set("Select Sheet...") self.TCombobox1.bind("<<ComboboxSelected>>", self.get_xy_columns) self.TLabel2 = ttk.Label (self.TLabelframe1) self.TLabel2.place(relx=0.03,rely=0.73,height=19,width=127) self.TLabel2.configure(relief="flat") self.TLabel2.configure(text='''Y / Northing / Latitude:''') self.TCombobox2 = ttk.Combobox (self.TLabelframe1, state='readonly') self.TCombobox2.place(relx=0.42,rely=0.58,relheight=0.08,relwidth=0.55) self.TCombobox2.configure(textvariable=combobox2) self.TCombobox2.configure(takefocus="") self.TCombobox2.set("Select X Column...") self.TCombobox3 = ttk.Combobox (self.TLabelframe1, state='readonly') self.TCombobox3.place(relx=0.42,rely=0.73,relheight=0.08,relwidth=0.55) self.TCombobox3.configure(textvariable=combobox3) self.TCombobox3.configure(takefocus="") self.TCombobox3.set("Select Y Column...") self.TLabel3 = ttk.Label (self.TLabelframe1) self.TLabel3.place(relx=0.03,rely=0.44,height=19,width=253) self.TLabel3.configure(relief="flat") self.TLabel3.configure(text='''Select the columns for the X and Y coordinates:''') self.TLabel4 = ttk.Label (self.TLabelframe1) self.TLabel4.place(relx=0.03,rely=0.11,height=19,width=307) self.TLabel4.configure(relief="flat") self.TLabel4.configure(text='''Select the Excel sheet containing X and Y coordinate data:''') self.TButton1 = ttk.Button (master, command = self.run) self.TButton1.place(relx=0.75,rely=0.76,height=55,width=84) self.TButton1.configure(takefocus="") self.logoGE = PhotoImage(file='logo_ge.gif') self.TButton1.configure(text='''Generate KML''', \ image=self.logoGE, compound="top") self.TButton2 = ttk.Button (master, command = self.popup) self.TButton2.place(relx=0.77,rely=0.62,height=25,width=76) self.TButton2.configure(takefocus="") self.TButton2.configure(text='''Set CRS''') self.TCheckbutton1 = ttk.Checkbutton (master, command = self.crs) self.TCheckbutton1.place(relx=0.05,rely=0.76,relheight=0.05 ,relwidth=0.42) self.TCheckbutton1.configure(variable=tch33) self.TCheckbutton1.configure(takefocus="") self.TCheckbutton1.configure(text='''Transform & Write to Excel?''') self.TCombobox4 = ttk.Combobox (master, state='readonly') self.TCombobox4.place(relx=0.05,rely=0.83,relheight=0.05,relwidth=0.53) self.TCombobox4.configure(textvariable=combobox4) self.TCombobox4.configure(takefocus="") self.TCombobox4.set("Specify Output CRS...") self.TCombobox4.bind("<<ComboboxSelected>>", self.show_ref_sys_name) self.TLabel5 = ttk.Label (master) self.TLabel5.place(relx=0.05,rely=0.92,height=19,width=31) self.TLabel5.configure(relief="flat") self.TLabel5.configure(text='''CRS: ''') self.TLabel6 = ttk.Label (master) self.TLabel6.place(relx=0.12,rely=0.92,height=19,width=349) self.TLabel6.configure(relief="flat") self.TLabel6.configure(text='''-''') self.build_menu()