コード例 #1
0
    def __init__(self, parent):
        tk.Frame.__init__(self, parent)
        self.config(borderwidth=2, relief=tk.RAISED, background=COLORS.fr_read)
        self.grid(row=2, column=0, columnspan=8, sticky='W')

        self.filename = tk.StringVar()
        self.filename.set('Filename undefined')
        typestring = 'DISCUS / CIF / RMCprofile CMAKER files'
        typeext = '*.cell *.stru *.cif *.cssr *.txt *.CELL *.STRU *.CIF *.cssr *.TXT'
        self.caption = ttk.Label(self, text='Read an old structure from file')
        self.fileb = ttk.Button(
            self,
            text='Open',
            command=lambda: file_open(self, typestring, typeext))
        self.label_fle = ttk.Label(self,
                                   textvariable=self.filename,
                                   foreground=COLORS.ok_active,
                                   relief=tk.RAISED)
        self.acc = ttk.Button(self,
                              text='Run',
                              command=lambda: self.display_file(parent))
        #       create_exit_button(self,'discus',6,3,create_exit_button.donothing,(0,0))
        create_exit_button(self, 'discus', 6, 3, exit_command, (parent, 0))

        self.caption.grid(row=0, column=0, columnspan=5, pady=(10, 10))
        self.fileb.grid(row=1, column=0)
        self.label_fle.grid(row=2, column=0, columnspan=3)
        self.acc.grid(row=5, column=3)
        self.acc.configure(state='disabled')
        line = 'read'
        suite.suite_learn(line)
コード例 #2
0
ファイル: discus_save.py プロジェクト: rneder/DiffuseGUI
 def __init__(self, parent, sub_menu, pos_row, pos_col):
     tk.Frame.__init__ ( self, parent )
     self.config(borderwidth=4, relief=tk.RAISED, background=COLORS.fr_sub)
     self.grid(row=pos_row,column=pos_col,columnspan=8,sticky='W')
     #
     self.caption = ttk.Label(self, text='Atom type selection')
     self.all = ttk.Checkbutton(self, text='Select all types',
             variable = parent.var_sel_all)
     self.all.bind('<ButtonRelease-1>',
         lambda eff: self.press_all(eff, parent)
         ) 
     create_exit_button(self, 'discus', 1, 2, exit_subframe,(parent,0))
     #
     atom_list = []
     for i in range(parent.nscat+1):
         line = 'Type no. ' + str(i) + ' = ' + parent.at_list[i]
         cb = ttk.Checkbutton(self, text=line, variable=parent.atom_check[i])
         cb.bind('<ButtonRelease-1>',
             lambda eff: self.press_one(eff, parent)
             ) 
         atom_list.append(cb)
         cb.grid(row=2+i, column=0, sticky='EW')
         
     self.caption.grid(row=0,column=0, columnspan=5, pady=(10,10))
     self.all.grid(row=1,column=0, pady=(0,10), sticky='W')
コード例 #3
0
    def __init__(self, parent):
        tk.Frame.__init__(self, parent)
        self.config(borderwidth=2, relief=tk.RAISED, background=COLORS.fr_read)
        self.grid(row=3, column=0, columnspan=6, sticky='EW')

        self.filename = tk.StringVar()
        self.caption = ttk.Label(self, text="Load a data set")
        self.fileb = ttk.Button(
            self,
            text="File",
            command=lambda: self.filename.set(filedialog.askopenfilename()))
        self.isfiletype = tk.StringVar()
        self.l_type = ttk.Label(self, text="Filetype: ", relief=tk.RAISED)
        self.ftype = ttk.Combobox(self,
                                  textvariable=self.isfiletype,
                                  state='readonly')
        self.ftype['values'] = ('xy', 'ni')
        self.ftype.current(0)
        self.label_fle = ttk.Label(self,
                                   textvariable=self.filename,
                                   relief=tk.RAISED)
        self.acc = ttk.Button(self, text="Run", command=self.load_file)
        create_exit_button(self, 'kuplot', 3, 3, create_exit_button.donothing,
                           (0, 0))

        self.caption.grid(row=0, column=0, columnspan=5)
        self.fileb.grid(row=1, column=0)
        self.label_fle.grid(row=1, column=1, columnspan=3)
        self.l_type.grid(row=2, column=0)
        self.ftype.grid(row=2, column=1)
        self.acc.grid(row=3, column=2)
コード例 #4
0
 def __init__(self, parent):
     tk.Frame.__init__(self, parent)
     self.config(borderwidth=2, relief=tk.RAISED, background=COLORS.fr_read)
     self.grid(row=2, column=0, columnspan=8, sticky='W')
     #
     self.filename = tk.StringVar()
     self.filename.set('Filename undefined')
     self.typestring = 'CIF files'
     self.typeext = '*.cif *.CIF'
     #
     self.caption = ttk.Label(self, text='Import an external file format')
     #
     self.fileb = ttk.Button(
         self,
         text='Open',
         command=lambda: file_open(self, self.typestring, self.typeext))
     self.label_fle = ttk.Label(self,
                                textvariable=self.filename,
                                foreground=COLORS.ok_active,
                                relief=tk.RAISED)
     #
     self.yScroll = tk.Scrollbar(self, orient=tk.VERTICAL)
     self.lst_external = tk.Listbox(self,
                                    height=2,
                                    width=5,
                                    selectbackground=COLORS.en_back,
                                    selectforeground=COLORS.en_fore,
                                    selectmode=tk.SINGLE,
                                    yscrollcommand=self.yScroll.set)
     self.yScroll['command'] = self.lst_external.yview
     self.lst_external.configure(exportselection=False)
     self.lst_external.insert(0, 'CIF')
     self.lst_external.insert(1, 'SHELX')
     self.lst_external.insert(2, 'RMCprofile')
     self.lst_external.insert(3, 'CMAKER')
     self.lst_external.selection_set(0)
     self.lst_external.yview_scroll(0, tk.UNITS)
     #
     self.lst_external.bind('<ButtonRelease-1>',
                            lambda eff: self.convert_external(eff, self))
     #
     self.acc = ttk.Button(self,
                           text='Run',
                           command=lambda: self.do_import())
     create_exit_button(self, 'discus', 6, 7, exit_command, (parent, 0))
     #
     # Grid everything
     self.caption.grid(row=0, column=0, columnspan=5, pady=(10, 10))
     self.lst_external.grid(row=2, column=0, rowspan=2, sticky='EW')
     self.yScroll.grid(row=1, column=2, rowspan=2, sticky='W')
     self.fileb.grid(row=4, column=0)
     self.label_fle.grid(row=5, column=0, columnspan=3)
     self.acc.grid(row=5, column=7)
     #
     self.acc.configure(state='disabled')
コード例 #5
0
ファイル: discus_save.py プロジェクト: rneder/DiffuseGUI
 def __init__(self, parent, sub_menu, pos_row, pos_col):
     tk.Frame.__init__ ( self, parent )
     self.config(borderwidth=4, relief=tk.RAISED, background=COLORS.fr_sub)
     self.grid(row=pos_row,column=pos_col,columnspan=8,sticky='W')
     #
     self.caption=ttk.Label(self, text='Keyword selection')
     self.label_all  = ttk.Label(self, text='All values')
     self.check_all  = ttk.Checkbutton(self, text='Write', variable=parent.wr_all)
     self.label_scat = ttk.Label(self, text='scat/ADP')
     self.check_scat = ttk.Checkbutton(self, text='Write', variable=parent.wr_scat)
     self.label_ncell= ttk.Label(self, text='ncell')
     self.check_ncell= ttk.Checkbutton(self, text='Write', variable=parent.wr_ncell)
     self.label_molec= ttk.Label(self, text='Molecules')
     self.check_molec= ttk.Checkbutton(self, text='Write', variable=parent.wr_molec)
     self.label_domain=ttk.Label(self, text='Domains')
     self.check_domain=ttk.Checkbutton(self, text='Write', variable=parent.wr_domain)
     self.label_object= ttk.Label(self, text='Objects')
     self.check_object= ttk.Checkbutton(self, text='Write', variable=parent.wr_object)
     self.label_gener= ttk.Label(self, text='Generators')
     self.check_gener= ttk.Checkbutton(self, text='Write', variable=parent.wr_gener)
     self.label_symme= ttk.Label(self, text='Symmetry')
     self.check_symme= ttk.Checkbutton(self, text='Write', variable=parent.wr_symme)
     create_exit_button(self, 'discus', 8, 4, exit_subframe,(parent,0))
     #
     self.caption.grid(row=0,column=0, columnspan=5, pady=(10,10))
     self.label_all.grid(row=4, column=0, sticky='EW')
     self.check_all.grid(row=4, column=1)
     self.label_scat.grid(row=5, column=0, sticky='EW')
     self.check_scat.grid(row=5, column=1)
     self.label_ncell.grid(row=6, column=0, sticky='EW')
     self.check_ncell.grid(row=6, column=1)
     self.label_molec.grid(row=7, column=0, sticky='EW')
     self.check_molec.grid(row=7, column=1)
     self.label_domain.grid(row=8, column=0, sticky='EW')
     self.check_domain.grid(row=8, column=1)
     self.label_object.grid(row=9, column=0, sticky='EW')
     self.check_object.grid(row=9, column=1)
     self.label_gener.grid(row=10, column=0, sticky='EW')
     self.check_gener.grid(row=10, column=1)
     self.label_symme.grid(row=11, column=0, sticky='EW')
     self.check_symme.grid(row=11, column=1)
コード例 #6
0
    def __init__(self, parent):
        tk.Frame.__init__(self, parent)
        self.config(borderwidth=2, relief=tk.RAISED, background=COLORS.fr_read)
        self.grid(row=2, column=0, columnspan=8, sticky='W')
        #
        four_last = suite.discus_get_four_last()
        #
        typestring = 'DISCUS output'
        typeext = '*.inte *.real *.ampl *.imag *.phase'
        self.filename = tk.StringVar()
        self.filename.set('Filename undefined')
        self.caption = ttk.Label(self, text='Write Fourier pattern to disk')
        self.fileb = ttk.Button(
            self,
            text='Save as',
            command=lambda: file_new(self, typestring, typeext))
        self.label_fle = ttk.Label(self,
                                   textvariable=self.filename,
                                   relief=tk.RAISED,
                                   foreground=COLORS.warning)
        #
        self.label_val = ttk.Label(self, text='Value')
        self.valScroll = tk.Scrollbar(self, orient=tk.VERTICAL)
        self.val = tk.Listbox(self,
                              height=2,
                              width=15,
                              selectbackground=COLORS.en_back,
                              selectforeground=COLORS.ok_front,
                              selectmode=tk.SINGLE,
                              yscrollcommand=self.valScroll.set)
        self.valScroll['command'] = self.val.yview
        self.val.configure(exportselection=False)
        if four_last > 0 and four_last < 4:  # Standard Fourier
            self.val_list = [
                'inten', 'ampl', 'real', 'imag', 'phase', 'f2aver', 'faver2'
            ]
            self.val.insert(0, 'Intensity')
            self.val.insert(1, 'Amplitude')
            self.val.insert(2, 'Real part')
            self.val.insert(3, 'Imaginary part')
            self.val.insert(4, 'Phase angle')
            self.val.insert(5, '<form^2>')
            self.val.insert(6, '<form>^2')
            typestring = 'DISCUS output'
            typeext = '*.inte *.real *.ampl *.imag *.phase'
        elif four_last < 0 or four_last == 4:  # Lots, zone axis
            self.val_list = ['inten']
            self.val.insert(0, 'Intensity')
            typestring = 'DISCUS output'
            typeext = '*.inte'
        elif four_last == 8 or four_last == 9:  # powder
            self.val_list = ['inten', 'S(Q)', 'F(Q)', 'f2aver', 'faver2']
            self.val.insert(0, 'Intensity')
            self.val.insert(1, 'S(Q)')
            self.val.insert(2, 'F(Q)')
            self.val.insert(3, '<form^2>')
            self.val.insert(4, '<form>^2')
            typestring = 'DISCUS output'
            typeext = '*.inte *.Q *.tth *.SQ *.FQ'
        elif four_last > 4 and four_last < 8:  # Patterson Inverse Diff-Four
            self.val_list = ['ampl']
            self.val.insert(0, 'Amplitude')
            typestring = 'DISCUS output'
            typeext = '*.ampl'
        else:
            self.val_list = ['inten']
            self.val.insert(0, 'None')
            typestring = 'DISCUS output'
            typeext = '*.inte'
        self.val.selection_set(0)
        #
        self.label_frm = ttk.Label(self, text='Format')
        self.frmScroll = tk.Scrollbar(self, orient=tk.VERTICAL)
        self.frm = tk.Listbox(self,
                              height=2,
                              width=10,
                              selectbackground=COLORS.en_back,
                              selectforeground=COLORS.en_fore,
                              selectmode=tk.SINGLE,
                              yscrollcommand=self.frmScroll.set)
        self.frmScroll['command'] = self.frm.yview
        self.frm.configure(exportselection=False)
        if four_last > 0 and four_last < 8:  # Standard Fourier , Zone axis, Patterson
            self.frm_list = ['stan', 'mrc']
            self.frm.insert(0, 'Standard')
            self.frm.insert(1, 'MRC')
        elif four_last == 8 or four_last == 9:  # Powder
            self.frm_list = ['powder', 'powder, tth', 'powder, q']
            self.frm.insert(0, 'Powder')
            self.frm.insert(1, 'Powder 2Theta')
            self.frm.insert(1, 'Powder Q-scale')
        else:
            self.frm_list = ['stan']
            self.frm.insert(0, 'None')
        self.frm.selection_set(0)
        if four_last == 3 or four_last == -3:
            self.frm.selection_set(1)
        #

        self.acc = ttk.Button(
            self,
            text='Run',
            command=lambda: self.write_file(parent, four_last))
        #       create_exit_button(self, 'discus', 6, 6, create_exit_button.donothing, (0, 0))
        create_exit_button(self, 'discus', 6, 6, exit_command,
                           (parent, four_last))
        #
        self.caption.grid(row=0, column=0, columnspan=5, pady=(10, 10))
        self.fileb.grid(row=1, column=0)
        #
        self.label_fle.grid(row=2,
                            column=0,
                            columnspan=5,
                            padx=(10, 20),
                            sticky='W')
        self.label_val.grid(row=3, column=0, sticky='EWNS')
        self.val.grid(row=3, column=1, sticky='EWNS', pady=(5, 0))
        self.valScroll.grid(row=3, column=2, sticky='E', pady=(5, 0))
        self.label_frm.grid(row=3, column=3, sticky='EWNS', padx=(5, 0))
        self.frm.grid(row=3, column=4, sticky='EWNS', pady=(5, 0))
        self.frmScroll.grid(row=3, column=5, sticky='E', pady=(5, 0))
        self.acc.grid(row=5, column=6)
        #
        self.acc.configure(state='disabled')
        #
        line = 'output'
        suite.suite_learn(line)
コード例 #7
0
ファイル: discus_save.py プロジェクト: rneder/DiffuseGUI
    def __init__(self, parent):
        tk.Frame.__init__ ( self, parent )
        self.config(borderwidth=2, relief=tk.RAISED, background=COLORS.fr_read)
        self.grid(row=2,column=0,columnspan=8,sticky='W')
        #
        self.nscat, self.at_list = get_scat()
        #
        bsavefile, file_length, sel_atom, w_scat, w_ncell, w_mol, w_dom, w_obj, \
                w_gen, w_sym, \
                w_start, w_end, p_all, p_nor, p_mol, p_dom, p_out, p_ext, \
                p_int, p_lig = suite.discus_get_save()
        #
        line = bsavefile.decode()[0]
        for j in range(file_length-1):
            line = line + bsavefile.decode()[j+1]
        self.filename = tk.StringVar()
        if bsavefile.decode() != ' ':
            self.filename.set(line)
        else:
            self.filename.set('Filename undefined')
        self.wr_all  = tk.IntVar()
        self.wr_scat = tk.IntVar()
        self.wr_ncell = tk.IntVar()
        self.wr_molec = tk.IntVar()
        self.wr_object = tk.IntVar()
        self.wr_domain = tk.IntVar()
        self.wr_gener = tk.IntVar()
        self.wr_symme = tk.IntVar()
        #
        self.var_p_all = tk.IntVar()
        self.var_p_nor = tk.IntVar()
        self.var_p_mol = tk.IntVar()
        self.var_p_dom = tk.IntVar()
        self.var_p_out = tk.IntVar()
        self.var_p_ext = tk.IntVar()
        self.var_p_int = tk.IntVar()
        self.var_p_lig = tk.IntVar()
        #
        self.var_sel_all = tk.IntVar()
        self.var_sel_atoms = np.ones((self.nscat+1))
        self.var_sel_all.set(1)
        self.atom_check = []
        for i in range(self.nscat+1):
            number=tk.IntVar()
            number.set(1)
            self.atom_check.append(number)
            print(' SELECT ATOM ? ' + str(i) + ' ' + str(self.atom_check[i].get()))
        #
        if w_scat==1 and w_ncell==1 and w_mol==1 and w_dom==1 and w_obj==1 \
                and w_gen==1 and w_sym==1:
            self.wr_all.set(1)
        else:
            self.wr_all.set(0)
        self.wr_scat.set(w_scat)
        self.wr_ncell.set(w_ncell)
        self.wr_molec.set(w_mol)
        self.wr_domain.set(w_dom)
        self.wr_object.set(w_obj)
        self.wr_gener.set(w_gen)
        self.wr_symme.set(w_sym)
        self.var_p_all.set(p_all)
        self.var_p_nor.set(p_nor)
        self.var_p_mol.set(p_mol)
        self.var_p_dom.set(p_dom)
        self.var_p_out.set(p_out)
        self.var_p_ext.set(p_ext)
        self.var_p_int.set(p_int)
        self.var_p_lig.set(p_lig)
        #
        typestring = 'DISCUS files'
        typeext    = '*.cell *.stru *.CELL *.STRU'
        self.caption=ttk.Label(self, text='Save a structure to file')
        self.fileb = ttk.Button(self, text='Save as:',
                   command=lambda: file_new(self, typestring, typeext))
        self.label_fle = ttk.Label(self, textvariable=self.filename, 
                   foreground=COLORS.ok_active, relief=tk.RAISED)
        #
        self.sub_menu = 'save'
        self.sel_at = ttk.Button(self, text='Select Atom types',
                   command=lambda: atsel_gui(self, self.sub_menu, 3, 4))
        self.propb = ttk.Button(self, text='Properties',
                   command=lambda: prop_gui(self, self.sub_menu, 3, 4))
        self.keywd = ttk.Button(self, text='Keywords',
                   command=lambda: key_gui(self, self.sub_menu, 4, 4))
        #
        self.show = ttk.Button(self, text='Show', command=lambda: self.do_show(parent))
        self.acc = ttk.Button(self, text='Run', command=lambda: self.do_save(parent))
        create_exit_button(self, 'discus', 8, 4, exit_command,(parent,0))

        self.caption.grid(row=0,column=0, columnspan=5, pady=(10,10))
        self.fileb.grid(row=1, column=0)
        self.label_fle.grid(row=2, column=0, columnspan=4, sticky='W')
        self.sel_at.grid(row=3, column=0, columnspan=1, pady=(10,0))
        self.propb.grid(row=3, column=2, columnspan=1, pady=(10,0))
        self.keywd.grid(row=4, column=2, columnspan=1, pady=(10,0))
        self.show.grid(row=6, column=4)
        self.acc.grid(row=7, column=4)
        if self.filename.get == 'Filename undefined':
            self.acc.configure(state='disabled')
        else:
            self.acc.configure(state='normal')
        line = 'save'
        suite.suite_learn(line)
コード例 #8
0
    def __init__(self, parent):
        tk.Frame.__init__(self, parent)
        self.config(borderwidth=2, relief=tk.RAISED, background=COLORS.fr_read)
        self.grid(row=2, column=0, columnspan=8, sticky='W')
        #  Get Element symbols and characteristic wavelength from DISCUS
        nspcgr, self.spcgr, self.systems = get_spcgr()
        #
        self.para_a = tk.StringVar()
        self.para_b = tk.StringVar()
        self.para_c = tk.StringVar()
        self.para_alpha = tk.StringVar()
        self.para_beta = tk.StringVar()
        self.para_gamma = tk.StringVar()
        self.spcgr_type = tk.IntVar()
        self.spcgr_name = tk.StringVar()
        self.spcgr_numb = tk.StringVar()
        #
        self.para_a.set('5.0')
        self.para_b.set('5.0')
        self.para_c.set('5.0')
        self.para_alpha.set('90.0')
        self.para_beta.set('90.0')
        self.para_gamma.set('90.0')
        self.spcgr_type.set(0)
        self.spcgr_name.set('P1')
        self.spcgr_numb.set('1')
        #
        self.caption = ttk.Label(self, text='Define an empty arbitrary space')
        self.label_a = ttk.Label(self, text='a')
        self.label_b = ttk.Label(self, text='b')
        self.label_c = ttk.Label(self, text='c')
        self.entry_a = ttk.Entry(self,
                                 textvariable=self.para_a,
                                 width=10,
                                 justify='right',
                                 foreground=COLORS.en_fore)
        self.entry_b = ttk.Entry(self,
                                 textvariable=self.para_a,
                                 width=10,
                                 justify='right',
                                 foreground=COLORS.en_fore)
        self.entry_c = ttk.Entry(self,
                                 textvariable=self.para_a,
                                 width=10,
                                 justify='right',
                                 foreground=COLORS.en_fore)
        self.label_alpha = ttk.Label(self, text='alpha')
        self.label_beta = ttk.Label(self, text='beta')
        self.label_gamma = ttk.Label(self, text='gamma')
        self.entry_alpha = ttk.Entry(self,
                                     textvariable=self.para_alpha,
                                     width=10,
                                     justify='right',
                                     foreground=COLORS.en_fore)
        self.entry_beta = ttk.Entry(self,
                                    textvariable=self.para_beta,
                                    width=10,
                                    justify='right',
                                    foreground=COLORS.en_fore)
        self.entry_gamma = ttk.Entry(self,
                                     textvariable=self.para_gamma,
                                     width=10,
                                     justify='right',
                                     foreground=COLORS.en_fore)
        self.R0 = tk.Radiobutton(self,
                                 text='Space group symbol',
                                 variable=self.spcgr_type,
                                 value=0,
                                 activeforeground=COLORS.ok_active,
                                 foreground=COLORS.ok_front,
                                 command=lambda: self.setup_spcgr(0))
        self.R1 = tk.Radiobutton(self,
                                 text='Space group number',
                                 variable=self.spcgr_type,
                                 value=1,
                                 command=lambda: self.setup_spcgr(1))
        self.yScroll = tk.Scrollbar(self, orient=tk.VERTICAL)
        self.lst_spcgr_name = tk.Listbox(self,
                                         height=2,
                                         width=5,
                                         selectbackground=COLORS.en_back,
                                         selectforeground=COLORS.en_fore,
                                         selectmode=tk.SINGLE,
                                         yscrollcommand=self.yScroll.set)
        self.yScroll['command'] = self.lst_spcgr_name.yview
        self.lst_spcgr_name.configure(exportselection=False)
        for i in range(nspcgr):
            self.lst_spcgr_name.insert(i, self.spcgr[i])
        self.lst_spcgr_name.selection_set(1)
        self.lst_spcgr_name.yview_scroll(1, tk.UNITS)

        #self.entry_spcgr_name = ttk.Entry(self, textvariable=self.spcgr_name, width=10,
        #        justify='right', foreground=COLORS.en_fore
        #        )
        self.entry_spcgr_numb = ttk.Entry(self,
                                          textvariable=self.spcgr_numb,
                                          width=10,
                                          justify='right',
                                          foreground=COLORS.en_fore)
        self.label_choice = ttk.Label(self, text='Origin choice')
        self.choice = tk.Spinbox(self,
                                 from_=1,
                                 to=2,
                                 width=3,
                                 background=COLORS.en_back,
                                 foreground=COLORS.ok_front)
        #
        self.acc = ttk.Button(self,
                              text='Run',
                              command=lambda: self.define_free(parent))
        create_exit_button(self, 'discus', 6, 7, exit_command, (parent, 0))
        #
        # Grid everything
        self.caption.grid(row=0, column=0, columnspan=5, pady=(10, 10))
        self.label_a.grid(row=1, column=0, sticky='EW')
        self.label_b.grid(row=2, column=0, sticky='EW')
        self.label_c.grid(row=3, column=0, sticky='EW')
        self.entry_a.grid(row=1, column=1, sticky='EW')
        self.entry_b.grid(row=2, column=1, sticky='EW')
        self.entry_c.grid(row=3, column=1, sticky='EW')
        self.label_alpha.grid(row=1, column=2, sticky='EW')
        self.label_beta.grid(row=2, column=2, sticky='EW')
        self.label_gamma.grid(row=3, column=2, sticky='EW')
        self.entry_alpha.grid(row=1, column=3, sticky='EW')
        self.entry_beta.grid(row=2, column=3, sticky='EW')
        self.entry_gamma.grid(row=3, column=3, sticky='EW')
        self.R0.grid(row=5, column=0, columnspan=3, sticky=tk.W)
        self.R1.grid(row=6, column=0, columnspan=3, sticky=tk.W)
        self.lst_spcgr_name.grid(row=4, column=3, rowspan=2, sticky='EW')
        self.yScroll.grid(row=4, column=4, rowspan=3, sticky='W')
        self.entry_spcgr_numb.grid(row=6, column=3, sticky='EW')
        self.label_choice.grid(row=5, column=5, sticky='EW')
        self.choice.grid(row=5, column=6, sticky='EW')
        self.acc.grid(row=5, column=7)
        #
        self.setup_spcgr(self.spcgr_type.get())
        self.acc.configure(state='normal')
コード例 #9
0
    def __init__(self, parent):
        tk.Frame.__init__(self, parent)
        self.config(borderwidth=2, relief=tk.RAISED, background=COLORS.fr_read)
        self.grid(row=2, column=0, columnspan=8, sticky='W')

        self.cell_type = tk.IntVar()
        self.cell_type.set(0)
        self.filename = tk.StringVar()
        self.filename.set('Filename undefined')
        self.caption = ttk.Label(self,
                                 text='Expand an asymmetric unit from file')
        self.fileb = ttk.Button(self, text='Open', command=self.open_file)
        self.treat = ttk.Label(self, text='Treat atoms with\nequal names as:')
        self.label_fle = ttk.Label(self,
                                   textvariable=self.filename,
                                   relief=tk.RAISED,
                                   foreground=COLORS.ok_active)
        self.R1 = tk.Radiobutton(self,
                                 text='Equal types ',
                                 variable=self.cell_type,
                                 value=0,
                                 activeforeground=COLORS.ok_active,
                                 foreground=COLORS.ok_front)
        self.R2 = tk.Radiobutton(self,
                                 text='Sep. types',
                                 variable=self.cell_type,
                                 value=1,
                                 activeforeground=COLORS.ok_active,
                                 foreground=COLORS.ok_front)
        self.exp = ttk.Label(self, text='Expand to unit cells:')
        self.nx_l = ttk.Label(self, text='NX:')
        self.ny_l = ttk.Label(self, text='NY:')
        self.nz_l = ttk.Label(self, text='NZ:')
        self.nx = tk.Spinbox(self,
                             from_=1,
                             to=1000,
                             width=10,
                             background=COLORS.en_back,
                             foreground=COLORS.ok_front)
        self.ny = tk.Spinbox(self,
                             from_=1,
                             to=1000,
                             width=10,
                             background=COLORS.en_back,
                             foreground=COLORS.ok_front)
        self.nz = tk.Spinbox(self,
                             from_=1,
                             to=1000,
                             width=10,
                             background=COLORS.en_back,
                             foreground=COLORS.ok_front)
        self.acc = ttk.Button(self,
                              text='Run',
                              command=lambda: self.display_file(parent))
        create_exit_button(self, 'discus', 6, 3, exit_command, (parent, 0))
        #
        self.caption.grid(row=0, column=0, columnspan=5, pady=(10, 10))
        self.fileb.grid(row=1, column=0)
        self.treat.grid(row=1, column=3)
        self.R1.grid(row=2, column=3, sticky=tk.W)
        self.R2.grid(row=3, column=3, sticky=tk.W)
        self.exp.grid(row=3, column=0, columnspan=2)
        self.nx_l.grid(row=4, column=0)
        self.ny_l.grid(row=5, column=0)
        self.nz_l.grid(row=6, column=0)
        self.nx.grid(row=4, column=1, sticky='W')
        self.ny.grid(row=5, column=1, sticky='W')
        self.nz.grid(row=6, column=1, sticky='W')
        self.acc.grid(row=5, column=3)
        self.label_fle.grid(row=2,
                            column=0,
                            columnspan=3,
                            padx=(10, 20),
                            sticky='W')
        self.acc.configure(state='disabled')
        self.nx.configure(state='disabled')
        self.ny.configure(state='disabled')
        self.nz.configure(state='disabled')
        self.R1.configure(state='disabled')
        self.R2.configure(state='disabled')
        line = 'read'
        suite.suite_learn(line)
コード例 #10
0
    def __init__(self, parent):
        tk.Frame.__init__(self, parent)
        self.config(borderwidth=2, relief=tk.RAISED, background=COLORS.fr_read)
        self.grid(row=2, column=0, columnspan=8, sticky='EW')
        #
        # Get PDF settings from DISCUS
        radiation, adp, r_max, r_step, lrho0, rho0, corr_lin, corr_quad, \
                period, exact, weight, finite, sphere, qmax, qbroad, qdamp \
                = suite.discus_get_pdf()
        #
        # Round input to 5 digits
        r_max = round_rbn(r_max, 5)
        r_step = round_rbn(r_step, 5)
        rho0 = round_rbn(rho0, 5)
        weight = round_rbn(weight, 5)
        sphere = round_rbn(sphere, 5)
        corr_lin = round_rbn(corr_lin, 5)
        corr_quad = round_rbn(corr_quad, 5)
        qmax = round_rbn(qmax, 5)
        qbroad = round_rbn(qbroad, 8)
        qdamp = round_rbn(qdamp, 8)
        #
        # Define variables
        #       self.lim_min = tk.StringVar()  ' Reserved for later use
        self.lim_max = tk.StringVar()
        self.lim_step = tk.StringVar()
        self.rho0 = tk.StringVar()
        self.rho0_type = tk.IntVar()
        self.corr_lin = tk.StringVar()
        self.corr_quad = tk.StringVar()
        self.corr_type = tk.IntVar()
        self.peri_type = tk.IntVar()
        self.exct_type = tk.IntVar()
        self.weight = tk.StringVar()
        self.finite_type = tk.IntVar()
        self.sphere = tk.StringVar()
        self.qmax = tk.StringVar()
        self.qbroad = tk.StringVar()
        self.qdamp = tk.StringVar()
        self.filename = tk.StringVar()
        #
        self.lim_max.set(r_max)
        self.lim_step.set(r_step)
        self.rho0.set(rho0)
        self.rho0_type.set(lrho0)
        self.corr_lin.set(corr_lin)
        self.corr_quad.set(corr_quad)
        if corr_lin > 0.0:
            self.corr_type.set(0)
        elif corr_quad > 0.0:
            self.corr_type.set(1)
        else:
            self.corr_type.set(0)
        self.peri_type.set(period)
        self.exct_type.set(exact)
        self.weight.set(weight)
        self.finite_type.set(finite)
        self.sphere.set(sphere)
        self.qmax.set(qmax)
        self.qbroad.set(qbroad)
        self.qdamp.set(qdamp)
        self.filename.set('Filename undefined')
        #
        self.caption = ttk.Label(
            self, text='Pair Distribution Function calculations')

        self.label_limits = ttk.Label(self, text='PDF range:')
        #       self.label_min    = ttk.Label(self, text='Min:')
        self.label_max = ttk.Label(self, text='Max:')
        self.label_step = ttk.Label(self, text='Step:')
        #       self.entry_min = ttk.Entry(self,textvariable=self.lim_min, width=10,
        #               justify='right', foreground=COLORS.en_fore
        #               )
        self.entry_max = ttk.Entry(self,
                                   textvariable=self.lim_max,
                                   width=10,
                                   justify='right',
                                   foreground=COLORS.en_fore)
        self.entry_step = ttk.Entry(self,
                                    textvariable=self.lim_step,
                                    width=10,
                                    justify='right',
                                    foreground=COLORS.en_fore)
        self.label_rho0 = ttk.Label(self, text='Numb. density:')
        self.R1 = tk.Radiobutton(self,
                                 text='Automatic',
                                 variable=self.rho0_type,
                                 value=1,
                                 activeforeground=COLORS.ok_active,
                                 foreground=COLORS.ok_front,
                                 justify='left',
                                 command=lambda: self.setup_rho0(1))
        self.R0 = tk.Radiobutton(self,
                                 text='Value    ',
                                 variable=self.rho0_type,
                                 value=0,
                                 activeforeground=COLORS.ok_active,
                                 foreground=COLORS.ok_front,
                                 justify='left',
                                 command=lambda: self.setup_rho0(0))
        self.entry_rho0 = ttk.Entry(self,
                                    textvariable=self.rho0,
                                    width=10,
                                    justify='right',
                                    foreground=COLORS.en_fore)
        self.label_corr = ttk.Label(self, text='Corr. correct.:')
        self.C0 = tk.Radiobutton(self,
                                 text='linear',
                                 variable=self.corr_type,
                                 value=0,
                                 activeforeground=COLORS.ok_active,
                                 foreground=COLORS.ok_front,
                                 justify='left',
                                 command=lambda: self.setup_corr(0))
        self.C1 = tk.Radiobutton(self,
                                 text='quadratic',
                                 variable=self.corr_type,
                                 value=1,
                                 activeforeground=COLORS.ok_active,
                                 foreground=COLORS.ok_front,
                                 justify='left',
                                 command=lambda: self.setup_corr(1))
        self.entry_corr_lin = ttk.Entry(self,
                                        textvariable=self.corr_lin,
                                        width=10,
                                        justify='right',
                                        foreground=COLORS.en_fore)
        self.entry_corr_quad = ttk.Entry(self,
                                         textvariable=self.corr_quad,
                                         width=10,
                                         justify='right',
                                         foreground=COLORS.en_fore)
        #
        self.label_peri = ttk.Label(self, text='Boundary cond.:')
        self.P1 = tk.Radiobutton(self,
                                 text='periodic',
                                 variable=self.peri_type,
                                 value=1,
                                 activeforeground=COLORS.ok_active,
                                 foreground=COLORS.ok_front,
                                 justify='left',
                                 command=lambda: self.setup_peri(0))
        self.P0 = tk.Radiobutton(self,
                                 text='crystal',
                                 variable=self.peri_type,
                                 value=0,
                                 activeforeground=COLORS.ok_active,
                                 foreground=COLORS.ok_front,
                                 justify='left',
                                 command=lambda: self.setup_peri(1))
        #       self.E0 = tk.Radiobutton(self,text='linear', variable=self.corr_type,
        #                 value=0, activeforeground=COLORS.ok_active,foreground=COLORS.ok_front, justify='left',
        #                 command=lambda: self.setup_corr( 0))
        #       self.E1 = tk.Radiobutton(self,text='quadratic', variable=self.corr_type,
        #                 value=1, activeforeground=COLORS.ok_active,foreground=COLORS.ok_front, justify='left',
        #                 command=lambda: self.setup_corr( 1))
        self.label_weight = ttk.Label(self, text='Scale factor:')
        self.entry_weight = ttk.Entry(self,
                                      textvariable=self.weight,
                                      width=10,
                                      justify='right',
                                      foreground=COLORS.en_fore)
        self.label_finite = ttk.Label(self, text='Finite size corr.:')
        self.F0 = tk.Radiobutton(self,
                                 text='infinite',
                                 variable=self.finite_type,
                                 value=0,
                                 activeforeground=COLORS.ok_active,
                                 foreground=COLORS.ok_front,
                                 justify='left',
                                 command=lambda: self.setup_finite(0))
        self.F1 = tk.Radiobutton(self,
                                 text='sphere',
                                 variable=self.finite_type,
                                 value=1,
                                 activeforeground=COLORS.ok_active,
                                 foreground=COLORS.ok_front,
                                 justify='left',
                                 command=lambda: self.setup_finite(1))
        self.entry_sphere = ttk.Entry(self,
                                      textvariable=self.sphere,
                                      width=10,
                                      justify='right',
                                      foreground=COLORS.en_fore)
        #
        typestring = 'DISCUS PDF files'
        typeext = '*.grcalc *.gr *.pdf'
        self.fileb = ttk.Button(
            self,
            text='Save as',
            command=lambda: file_new(self, typestring, typeext))
        self.label_fle = ttk.Label(self,
                                   textvariable=self.filename,
                                   relief=tk.RAISED,
                                   foreground=COLORS.ok_active)

        self.label_rad = ttk.Label(self, text='Radiation:')
        self.rad_type = tk.IntVar()
        self.rad_type.set(0)
        self.rad = tk.Listbox(self,
                              height=3,
                              width=10,
                              selectbackground=COLORS.en_back,
                              selectforeground=COLORS.ok_active,
                              selectmode=tk.SINGLE)
        self.rad.configure(exportselection=False)
        self.rad.insert(1, 'X-ray')
        self.rad.insert(2, 'neutron')
        self.rad.insert(3, 'electron')
        self.rad.selection_set(radiation)
        #
        #
        self.adp = tk.IntVar()
        self.adp.set(adp)
        self.label_adp = ttk.Label(self, text='ADP:')
        self.check_adp = ttk.Checkbutton(self, text='Use', variable=self.adp)
        #
        self.label_qmax = ttk.Label(self, text='Qmax:')
        self.entry_qmax = ttk.Entry(self,
                                    textvariable=self.qmax,
                                    width=10,
                                    justify='right',
                                    foreground=COLORS.en_fore)
        self.label_qbroad = ttk.Label(self, text='Qbroad:')
        self.entry_qbroad = ttk.Entry(self,
                                      textvariable=self.qbroad,
                                      width=10,
                                      justify='right',
                                      foreground=COLORS.en_fore)
        self.label_qdamp = ttk.Label(self, text='Qdamp:')
        self.entry_qdamp = ttk.Entry(self,
                                     textvariable=self.qdamp,
                                     width=10,
                                     justify='right',
                                     foreground=COLORS.en_fore)
        #
        self.show = ttk.Button(self,
                               text='Show',
                               command=lambda: self.show_pdf(parent))
        #
        self.acc = ttk.Button(self,
                              text='Run',
                              command=lambda: self.run_pdf(parent))
        create_exit_button(self, 'discus', 11, 8, self.exit_command,
                           (parent, 0))
        #
        # Grid all elements that were not placed via functions
        self.caption.grid(row=0,
                          column=0,
                          columnspan=9,
                          sticky='NS',
                          pady=(10, 10))
        self.label_limits.grid(row=2, column=0, columnspan=1, sticky='EW')
        #       self.label_min.grid   (row=1, column=1, columnspan=1, sticky='EW')
        self.label_max.grid(row=1, column=1, columnspan=1, sticky='EW')
        self.label_step.grid(row=1, column=2, columnspan=1, sticky='EW')
        #       self.entry_min.grid   (row=1, column=1, columnspan=1, sticky='EW')
        self.entry_max.grid(row=2, column=1, columnspan=1, sticky='EW')
        self.entry_step.grid(row=2, column=2, columnspan=1, sticky='EW')
        self.label_rho0.grid(row=3,
                             column=0,
                             columnspan=1,
                             sticky='EW',
                             pady=(5, 0))
        self.R1.grid(row=3, column=1, columnspan=1, sticky='EW', pady=(5, 0))
        self.R0.grid(row=4, column=1, columnspan=1, sticky='EW')
        self.entry_rho0.grid(row=4, column=2, columnspan=1, sticky='EW')
        self.label_corr.grid(row=5, column=0, columnspan=1, sticky='EW')
        self.C0.grid(row=5, column=1, columnspan=1, sticky='EW', pady=(5, 0))
        self.C1.grid(row=6, column=1, columnspan=1, sticky='EW')
        self.entry_corr_lin.grid(row=5,
                                 column=2,
                                 columnspan=1,
                                 sticky='EW',
                                 pady=(5, 0))
        self.entry_corr_quad.grid(row=6, column=2, columnspan=1, sticky='EW')
        self.label_peri.grid(row=7,
                             column=0,
                             columnspan=1,
                             sticky='EW',
                             pady=(5, 0))
        self.P1.grid(row=7, column=1, columnspan=1, sticky='EW', pady=(5, 0))
        self.P0.grid(row=8, column=1, columnspan=1, sticky='EW')
        self.label_weight.grid(row=9,
                               column=0,
                               columnspan=1,
                               sticky='EW',
                               pady=(5, 0))
        self.entry_weight.grid(row=9,
                               column=1,
                               columnspan=1,
                               sticky='EW',
                               pady=(5, 0))
        self.label_finite.grid(row=10,
                               column=0,
                               columnspan=1,
                               sticky='EW',
                               pady=(5, 0))
        self.F0.grid(row=10, column=1, columnspan=1, sticky='EW', pady=(5, 0))
        self.F1.grid(row=11, column=1, columnspan=1, sticky='EW')
        self.entry_sphere.grid(row=11, column=2, columnspan=1, sticky='EW')
        self.label_rad.grid(row=1, column=5, padx=(5, 0), sticky='EW')
        self.rad.grid(row=1, column=6, rowspan=3, sticky='EW')
        self.label_adp.grid(row=4, column=5, padx=(5, 0), sticky='EW')
        self.check_adp.grid(row=4, column=6, sticky='EW')
        self.label_qmax.grid(row=5, column=5, padx=(5, 0), sticky='EW')
        self.entry_qmax.grid(row=5, column=6, sticky='EW')
        self.label_qbroad.grid(row=6, column=5, padx=(5, 0), sticky='EW')
        self.entry_qbroad.grid(row=6, column=6, sticky='EW')
        self.label_qdamp.grid(row=7, column=5, padx=(5, 0), sticky='EW')
        self.entry_qdamp.grid(row=7, column=6, sticky='EW')
        self.fileb.grid(row=12, column=0)
        self.label_fle.grid(row=12,
                            column=1,
                            columnspan=5,
                            padx=(10, 20),
                            sticky='W')
        #
        self.show.grid(row=9, column=8, columnspan=1, sticky='EW')
        self.acc.grid(row=10, column=8, columnspan=1, sticky='EW')
        #
        line = 'powder'
        suite.suite_learn(line)
        #
        self.setup_rho0(self.rho0_type.get())
        self.setup_corr(self.corr_type.get())
        self.setup_finite(self.finite_type.get())
        #
        self.acc.configure(state='disabled')
コード例 #11
0
ファイル: discus_powder.py プロジェクト: rneder/DiffuseGUI
    def __init__(self, parent):
        tk.Frame.__init__ ( self, parent )
        self.config(borderwidth=2, relief=tk.RAISED, background=COLORS.fr_read)
        self.grid(row=2, column=0, columnspan=8, sticky='EW')
        #
        #  Get Element symbols and characteristic wavelength from DISCUS
        nwave, self.symbols, self.wavelengths = get_wave()
        #
        #  Get Powder  settings from DISCUS
        mode, axis, radiation, bElement, wvle, \
                ener, adp, ano, theta, qvalues, dhkl, shkl,  \
                profile, profile_eta, profile_uvw, profile_asy, profile_width,  \
                profile_delta, preferred, pref_dp, pref_pt, pref_hkl, \
                lp, lp_ang, lp_fac \
                = suite.discus_get_powder()
        #
        # Round input to 5 digits
        for i in range(len(qvalues)):
           qvalues[i] = round_rbn(qvalues[i],5)
           theta  [i] = round_rbn(theta[i],5)
        wvle = round_rbn(wvle,5)
        ener = round_rbn(ener,5)
        profile_eta = round_rbn(profile_eta,5)
        for i in range(len(profile_uvw)):
           profile_uvw[i] = round_rbn(profile_uvw[i],5)
        for i in range(len(profile_asy)):
           profile_asy[i] = round_rbn(profile_asy[i],5)
        profile_width = round_rbn(profile_width,5)
        profile_delta = round_rbn(profile_delta,5)
        pref_dp = round_rbn(pref_dp,5)
        pref_pt = round_rbn(pref_pt,5)
        for i in range(len(pref_hkl)):
           pref_hkl[i] = round_rbn(pref_hkl[i],5)
        lp_ang = round_rbn(lp_ang,5)
        lp_fac = round_rbn(lp_fac,5)
        #
        #       Determine if an element was given for its characteristic radiation
        Element = bElement.decode()
        ElementNumber = -1
        for i in range(nwave):
            if Element == self.symbols[i]:
                ElementNumber = i
                break
        # Define variables
        self.calc_mode = tk.IntVar()
        self.calc_mode.set(0)
        self.calc_axis = tk.IntVar()
        self.calc_axis.set(0)
        self.lim_min = tk.StringVar()
        self.lim_max = tk.StringVar()
        self.lim_step = tk.StringVar()
        self.profile_eta = tk.StringVar()
        self.profile_u   = tk.StringVar()
        self.profile_v   = tk.StringVar()
        self.profile_w   = tk.StringVar()
        self.profile_width = tk.StringVar()
        self.pref_dp = tk.StringVar()
        self.pref_pt = tk.StringVar()
        self.pref_h  = tk.StringVar()
        self.pref_k  = tk.StringVar()
        self.pref_l  = tk.StringVar()
        self.lp_ang  = tk.StringVar()
        self.lp_fac  = tk.StringVar()
        if axis==0:
            self.lim_min.set(str(qvalues[0]))
            self.lim_max.set(str(qvalues[1]))
            self.lim_step.set(str(qvalues[2]))
        elif axis==1:
            self.lim_min.set(str(theta[0]))
            self.lim_max.set(str(theta[1]))
            self.lim_step.set(str(theta[2]))
        self.profile_eta.set(str(profile_eta))
        self.profile_u.set(str(profile_uvw[0]))
        self.profile_v.set(str(profile_uvw[1]))
        self.profile_w.set(str(profile_uvw[2]))
        self.profile_width.set(str(profile_width))
        #
        self.pref_dp.set(str(pref_dp))
        self.pref_pt.set(str(pref_pt))
        self.pref_h.set(str(pref_hkl[0]))
        self.pref_k.set(str(pref_hkl[1]))
        self.pref_l.set(str(pref_hkl[2]))
        #
        self.lp_ang.set(str(lp_ang))
        self.lp_fac.set(str(lp_fac))
        #
        self.caption=ttk.Label(self, text='Powder diffraction calculations')
        self.label_mode = ttk.Label(self, text='Powder mode:')
        self.mode = tk.Listbox(self, height=2, width=15, selectbackground=COLORS.en_back,
                selectforeground=COLORS.en_fore, selectmode=tk.SINGLE
                )
        self.mode.configure(exportselection=False)
        self.mode.insert(0,'Debye-Equation')
        self.mode.insert(1,'Rec. Spc. Integr.')
        self.mode.selection_set(mode)
        #
        self.label_axis = ttk.Label(self, text='Powder axis:')
        self.axis = tk.Listbox(self, height=2, width=15, selectbackground=COLORS.en_back,
                selectforeground=COLORS.en_fore, selectmode=tk.SINGLE
                )
        self.axis.configure(exportselection=False)
#       self.axis.insert(0,'d-star')
        self.axis.insert(0,'Q[A^-1]')
        self.axis.insert(1,'2-Theta')
        self.axis.selection_set(axis)
        self.label_limits = ttk.Label(self, text='Powder range:')
        self.label_min    = ttk.Label(self, text='Min:')
        self.label_max    = ttk.Label(self, text='Max:')
        self.label_step   = ttk.Label(self, text='Step:')
        self.entry_min = ttk.Entry(self,textvariable=self.lim_min, width=10,
                justify='right', background=COLORS.en_back, foreground=COLORS.en_fore
                )
        self.entry_max = ttk.Entry(self,textvariable=self.lim_max, width=10, 
                justify='right', background=COLORS.en_back, foreground=COLORS.en_fore
                )
        self.entry_step= ttk.Entry(self,textvariable=self.lim_step,width=10, 
                justify='right', background=COLORS.en_back, foreground=COLORS.en_fore
                )
        # Set values and label according to powder axis
        self.convert_axis(0,0,qvalues, theta)
        #
        self.label_prof = ttk.Label(self, text='Profile:')
        self.prof_yScroll = tk.Scrollbar(self, orient=tk.VERTICAL)
        self.prof_func = tk.Listbox(self, height=2, width=15, 
                selectbackground=COLORS.en_back,
                selectforeground=COLORS.en_fore,selectmode=tk.SINGLE
                )
        self.prof_func.configure(exportselection=False)
        self.prof_func.insert(0,'None')
        self.prof_func.insert(1,'Gauss')
        self.prof_func.insert(2,'PseudoVoigt')
        self.prof_func.selection_set(profile)
        self.prof_func.yview_scroll(profile, tk.UNITS)
        self.prof_yScroll['command'] = self.prof_func.yview
        self.label_prof_eta = ttk.Label(self, text='Profile eta:')
        self.entry_prof_eta = ttk.Entry(self,textvariable=self.profile_eta, 
                width=10, justify='right', background=COLORS.en_back, 
                foreground=COLORS.en_fore
                )
        self.label_prof_uvw = ttk.Label(self, text='Profile uvw:')
        self.entry_prof_u   = ttk.Entry(self,textvariable=self.profile_u, 
                width=10, justify='right', background=COLORS.en_back, 
                foreground=COLORS.en_fore
                )
        self.entry_prof_v   = ttk.Entry(self,textvariable=self.profile_v, 
                width=10, justify='right', background=COLORS.en_back, 
                foreground=COLORS.en_fore
                )
        self.entry_prof_w   = ttk.Entry(self,textvariable=self.profile_w, 
                width=10, justify='right', background=COLORS.en_back, 
                foreground=COLORS.en_fore)
        self.label_prof_width = ttk.Label(self, text='Profile width:'
                )
        self.entry_prof_width = ttk.Entry(self,textvariable=self.profile_width, 
                width=10, justify='right', background=COLORS.en_back, 
                foreground=COLORS.en_fore)
        self.label_prof_units = ttk.Label(self, text='* FWHM'
                )
        #
        self.label_pref = ttk.Label(self, text='Preferred:')
        self.pref_yScroll = tk.Scrollbar(self, orient=tk.VERTICAL)
        self.pref_func = tk.Listbox(self, height=2, width=15,
                selectbackground=COLORS.en_back,
                selectforeground=COLORS.en_fore,selectmode=tk.SINGLE
                )
        self.pref_func.configure(exportselection=False)
        self.pref_func.insert(0,'None')
        self.pref_func.insert(1,'Rietveld')
        self.pref_func.insert(2,'March')
        self.pref_func.selection_set(preferred)
        self.pref_func.yview_scroll(preferred, tk.UNITS)
        self.pref_yScroll['command'] = self.pref_func.yview
        self.label_pref_dp = ttk.Label(self, text='Pref. Damp:')
        self.entry_pref_dp = ttk.Entry(self, textvariable=self.pref_dp, 
                width=10, justify='right', background=COLORS.en_back, 
                foreground=COLORS.en_fore
                )
        self.label_pref_pt = ttk.Label(self, text='Pref. Frac:')
        self.entry_pref_pt = ttk.Entry(self, textvariable=self.pref_pt, 
                width=10, justify='right', background=COLORS.en_back, 
                foreground=COLORS.en_fore
                )
        self.label_pref_hkl= ttk.Label(self, text='Pref. HKL :')
        self.entry_pref_h  = ttk.Entry(self, textvariable=self.pref_h, 
                width=10, justify='right', background=COLORS.en_back, 
                foreground=COLORS.en_fore
                )
        self.entry_pref_k  = ttk.Entry(self, textvariable=self.pref_k, 
                width=10, justify='right', background=COLORS.en_back, 
                foreground=COLORS.en_fore
                )
        self.entry_pref_l  = ttk.Entry(self, textvariable=self.pref_l, 
                width=10, justify='right', background=COLORS.en_back, 
                foreground=COLORS.en_fore
                )
        #
        self.label_lp = ttk.Label(self, text='LP Corr.:')
        self.lp_yScroll = tk.Scrollbar(self, orient=tk.VERTICAL)
        self.lp_func = tk.Listbox(self, height=2, width=15,
                selectbackground=COLORS.en_back,
                selectforeground=COLORS.en_fore, selectmode=tk.SINGLE
                )
        self.lp_func.configure(exportselection=False)
        self.lp_func.insert(0, 'None')
        self.lp_func.insert(1, 'Bragg-Br.')
        self.lp_func.insert(2, 'Neutron')
        self.lp_func.insert(3, 'Synchrotron')
        self.lp_func.selection_set(lp)
        self.lp_func.yview_scroll(lp, tk.UNITS)
        self.lp_yScroll['command'] = self.lp_func.yview
        self.label_lp_ang = ttk.Label(self, text='Mono.Theta')
        self.entry_lp_ang = ttk.Entry(self, textvariable=self.lp_ang, width=10, 
                justify='right', background=COLORS.en_back, 
                foreground=COLORS.en_fore
                )
        self.label_lp_fac = ttk.Label(self, text='Fraction:')
        self.entry_lp_fac = ttk.Entry(self, textvariable=self.lp_fac, width=10, 
                justify='right', background=COLORS.en_back, 
                foreground=COLORS.en_fore
                )
        #
        discus_rad_menu(self, nwave, radiation, wvle, ener, ElementNumber, 
                adp, ano, 1, 4
                )
        #
        # Do bindings to powder axis
        self.axis.bind('<ButtonRelease-1>', 
                lambda eff: self.convert_axis(eff, 1, qvalues, theta))
        self.prof_func.bind('<ButtonRelease-1>', 
                lambda eff: self.convert_profile(eff, 1, profile_uvw, profile_delta))
        self.pref_func.bind('<ButtonRelease-1>', 
                lambda eff: self.convert_pref(eff, 1, pref_dp, pref_pt, pref_hkl))
        self.lp_func.bind('<ButtonRelease-1>', 
                lambda eff: self.convert_lp(eff, 1, lp_ang, lp_fac))
        #
        self.convert_profile(0,0,profile_uvw, profile_delta)
        self.convert_pref(0,0,pref_dp, pref_pt, pref_hkl)
        self.convert_lp(0,0,lp_ang, lp_fac)
        #
        self.acc = ttk.Button(self, text='Run', command=lambda: self.run_powder(parent))
        #
        #
        self.show= ttk.Button(self, text='Show', command=lambda: self.show_powder(parent))
        #
        #
        create_exit_button(self,'discus',11,8,self.exit_command,(parent,0))
        #
        # Grid all elements that were not placed via functions
        self.caption.grid     (    row=0, column=0, columnspan=8, sticky='NS', pady=(10,10))
        self.label_mode.grid  (    row=1, column=0, columnspan=1, sticky='EW')
        self.mode.grid        (    row=1, column=1, columnspan=2, sticky='W')
        self.label_axis.grid  (    row=3, column=0, columnspan=1, sticky='EW')
        self.axis.grid        (    row=3, column=1, columnspan=2, sticky='W')
        self.label_limits.grid(    row=5, column=0, columnspan=1, sticky='EW')
        self.label_min.grid   (    row=4, column=1, columnspan=1, sticky='EW')
        self.label_max.grid   (    row=4, column=2, columnspan=1, sticky='EW')
        self.label_step.grid  (    row=4, column=3, columnspan=1, sticky='EW')
        self.entry_min.grid   (    row=5, column=1, columnspan=1, sticky='EW')
        self.entry_max.grid   (    row=5, column=2, columnspan=1, sticky='EW')
        self.entry_step.grid  (    row=5, column=3, columnspan=1, sticky='EW')
        self.label_prof.grid  (    row=6, column=0, columnspan=1, sticky='EW')
        self.prof_func.grid   (    row=6, column=1, columnspan=1, sticky='EW')
        self.prof_yScroll.grid(    row=6, column=2, columnspan=1, sticky='W')
        self.label_prof_eta.grid(  row=7, column=0, columnspan=1, sticky='EW')
        self.entry_prof_eta.grid(  row=7, column=1, columnspan=1, sticky='EW')
        self.label_prof_uvw.grid(  row=8, column=0, columnspan=1, sticky='EW')
        self.entry_prof_u.grid(    row=8, column=1, columnspan=1, sticky='EW')
        self.entry_prof_v.grid(    row=8, column=2, columnspan=1, sticky='EW')
        self.entry_prof_w.grid(    row=8, column=3, columnspan=1, sticky='EW')
        self.label_prof_width.grid(row=9, column=0, columnspan=1, sticky='EW')
        self.entry_prof_width.grid(row=9, column=1, columnspan=1, sticky='EW')
        self.label_prof_units.grid(row=9, column=2, columnspan=1, sticky='EW')
        self.show.grid(            row=9, column=8, columnspan=1, sticky='EW')
        self.acc.grid(             row=10, column=8, columnspan=1, sticky='EW')
        self.label_pref.grid(      row=10, column=0, columnspan=1, sticky='EW')
        self.pref_func.grid   (    row=10, column=1, columnspan=1, sticky='EW')
        self.pref_yScroll.grid(    row=10, column=2, columnspan=1, sticky='W')
        self.label_pref_dp.grid(   row=11, column=0, columnspan=1, sticky='EW')
        self.entry_pref_dp.grid(   row=11, column=1, columnspan=1, sticky='EW')
        self.label_pref_pt.grid(   row=12, column=0, columnspan=1, sticky='EW')
        self.entry_pref_pt.grid(   row=12, column=1, columnspan=1, sticky='EW')
        self.label_pref_hkl.grid(  row=13, column=0, columnspan=1, sticky='EW')
        self.entry_pref_h.grid(    row=13, column=1, columnspan=1, sticky='EW')
        self.entry_pref_k.grid(    row=13, column=2, columnspan=1, sticky='EW')
        self.entry_pref_l.grid(    row=13, column=3, columnspan=1, sticky='EW')
        self.label_lp.grid(        row=6, column=4, columnspan=1, sticky='EW')
        self.lp_func.grid   (      row=6, column=5, columnspan=1, sticky='EW',padx=(5,0))
        self.lp_yScroll.grid(      row=6, column=6, columnspan=1, sticky='W')
        self.label_lp_ang.grid(    row=7, column=4, columnspan=1, sticky='EW',padx=(5,0))
        self.entry_lp_ang.grid(    row=7, column=5, columnspan=1, sticky='EW')
        self.label_lp_fac.grid(    row=8, column=4, columnspan=1, sticky='EW',padx=(5,0))
        self.entry_lp_fac.grid(    row=8, column=5, columnspan=1, sticky='EW')
        #
        line = 'powder'
        suite.suite_learn(line)
コード例 #12
0
    def __init__(self, parent, sub_menu, pos_row, pos_col):
        tk.Frame.__init__ ( self, parent )
        self.config(borderwidth=4, relief=tk.RAISED, background=COLORS.fr_sub)
        self.grid(row=pos_row,column=pos_col,columnspan=8,sticky='W')
        #
        parent.var_p_all = tk.IntVar()
        parent.var_p_nor = tk.IntVar()
        parent.var_p_mol = tk.IntVar()
        parent.var_p_dom = tk.IntVar()
        parent.var_p_out = tk.IntVar()
        parent.var_p_ext = tk.IntVar()
        parent.var_p_int = tk.IntVar()
        parent.var_p_lig = tk.IntVar()
        parent.var_p_all.set(0)
        parent.var_p_nor.set(0)
        parent.var_p_mol.set(0)
        parent.var_p_dom.set(0)
        parent.var_p_out.set(0)
        parent.var_p_ext.set(0)
        parent.var_p_int.set(0)
        parent.var_p_lig.set(0)
        #
        self.caption=ttk.Label(self, text='Property selection')
        #
        self.label_p_all = ttk.Label(self, text='All props')
        self.r0_p_all = tk.Radiobutton(self, text='ignore',
                variable=parent.var_p_all, value=0,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                command=lambda: self.set_access(parent, 0, 0)
                )
        self.r1_p_all = tk.Radiobutton(self, text='present',
                variable=parent.var_p_all, value=1,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                command=lambda: self.set_access(parent, 0, 1)
                )
        self.r2_p_all = tk.Radiobutton(self, text='absent',
                variable=parent.var_p_all, value=2,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                command=lambda: self.set_access(parent, 0, 2)
                )
        self.r3_p_all = tk.Radiobutton(self, text='individually set', 
                variable=parent.var_p_all, value=3,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                command=lambda: self.set_access(parent, 0, 3)
                )
        #
        self.label_p_nor = ttk.Label(self, text='Atom is normal ')
        self.r0_p_nor = tk.Radiobutton(self, text='ignore',
                variable=parent.var_p_nor, value=0,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r1_p_nor = tk.Radiobutton(self, text='present',
                variable=parent.var_p_nor, value=1,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r2_p_nor = tk.Radiobutton(self, text='absent',
                variable=parent.var_p_nor, value=2,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        #
        self.label_p_mol = ttk.Label(self, text='Atom is in molecule')
        self.r0_p_mol = tk.Radiobutton(self, text='ignore',
                variable=parent.var_p_mol, value=0,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r1_p_mol = tk.Radiobutton(self, text='present',
                variable=parent.var_p_mol, value=1,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r2_p_mol = tk.Radiobutton(self, text='absent',
                variable=parent.var_p_mol, value=2,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        #
        self.label_p_dom = ttk.Label(self, text='Atom is in domain')
        self.r0_p_dom = tk.Radiobutton(self, text='ignore',
                variable=parent.var_p_dom, value=0,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r1_p_dom = tk.Radiobutton(self, text='present',
                variable=parent.var_p_dom, value=1,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r2_p_dom = tk.Radiobutton(self, text='absent',
                variable=parent.var_p_dom, value=2,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        #
        self.label_p_out = ttk.Label(self, text='Atom outside crystal')
        self.r0_p_out = tk.Radiobutton(self, text='ignore',
                variable=parent.var_p_out, value=0,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r1_p_out = tk.Radiobutton(self, text='present',
                variable=parent.var_p_out, value=1,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r2_p_out = tk.Radiobutton(self, text='absent',
                variable=parent.var_p_out, value=2,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        #
        self.label_p_ext = ttk.Label(self, text='Atom at ext. surf.')
        self.r0_p_ext = tk.Radiobutton(self, text='ignore',
                variable=parent.var_p_ext, value=0,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r1_p_ext = tk.Radiobutton(self, text='present',
                variable=parent.var_p_ext, value=1,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r2_p_ext = tk.Radiobutton(self, text='absent',
                variable=parent.var_p_ext, value=2,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        #
        self.label_p_int = ttk.Label(self, text='Atom at int. surf.')
        self.r0_p_int = tk.Radiobutton(self, text='ignore',
                variable=parent.var_p_int, value=0,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r1_p_int = tk.Radiobutton(self, text='present',
                variable=parent.var_p_int, value=1,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r2_p_int = tk.Radiobutton(self, text='absent',
                variable=parent.var_p_int, value=2,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        #
        self.label_p_lig = ttk.Label(self, text='Atom is in ligand')
        self.r0_p_lig = tk.Radiobutton(self, text='ignore',
                variable=parent.var_p_lig, value=0,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r1_p_lig = tk.Radiobutton(self, text='present',
                variable=parent.var_p_lig, value=1,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        self.r2_p_lig = tk.Radiobutton(self, text='absent',
                variable=parent.var_p_lig, value=2,
                activeforeground=COLORS.ok_active, foreground=COLORS.ok_front,
                justify='left',
                )
        #
#       self.acc = ttk.Button(self, text='Accept', command=lambda: self.set_prop(sub_menu))
        create_exit_button(self, 'discus', 8, 4, exit_command,(parent,0))
        #
        self.caption.grid(row=0,column=0, columnspan=5, pady=(10,10))
        self.label_p_all.grid(row=1, column=0, sticky='EW', pady=(0,10))
        self.r0_p_all.grid(row=1, column=1, pady=(0,10))
        self.r1_p_all.grid(row=1, column=2, pady=(0,10))
        self.r2_p_all.grid(row=1, column=3, pady=(0,10))
        self.r3_p_all.grid(row=1, column=4, pady=(0,10))
        self.label_p_nor.grid(row=2, column=0, sticky='EW')
        self.r0_p_nor.grid(row=2, column=1)
        self.r1_p_nor.grid(row=2, column=2)
        self.r2_p_nor.grid(row=2, column=3)
        self.label_p_mol.grid(row=3, column=0, sticky='EW')
        self.r0_p_mol.grid(row=3, column=1)
        self.r1_p_mol.grid(row=3, column=2)
        self.r2_p_mol.grid(row=3, column=3)
        self.label_p_dom.grid(row=4, column=0, sticky='EW')
        self.r0_p_dom.grid(row=4, column=1)
        self.r1_p_dom.grid(row=4, column=2)
        self.r2_p_dom.grid(row=4, column=3)
        self.label_p_out.grid(row=5, column=0, sticky='EW')
        self.r0_p_out.grid(row=5, column=1)
        self.r1_p_out.grid(row=5, column=2)
        self.r2_p_out.grid(row=5, column=3)
        self.label_p_ext.grid(row=6, column=0, sticky='EW')
        self.r0_p_ext.grid(row=6, column=1)
        self.r1_p_ext.grid(row=6, column=2)
        self.r2_p_ext.grid(row=6, column=3)
        self.label_p_int.grid(row=7, column=0, sticky='EW')
        self.r0_p_int.grid(row=7, column=1)
        self.r1_p_int.grid(row=7, column=2)
        self.r2_p_int.grid(row=7, column=3)
        self.label_p_lig.grid(row=8, column=0, sticky='EW')
        self.r0_p_lig.grid(row=8, column=1)
        self.r1_p_lig.grid(row=8, column=2)
        self.r2_p_lig.grid(row=8, column=3)
#       self.acc.grid(row=7, column=4)
        #
        self.set_access(parent, 0, 0)
コード例 #13
0
ファイル: discus_fourier.py プロジェクト: rneder/DiffuseGUI
    def __init__(self, parent):
        tk.Frame.__init__(self, parent)
        self.config(borderwidth=2, relief=tk.RAISED, background=COLORS.fr_read)
        self.grid(row=2, column=0, columnspan=8, sticky='EW')
        #
        #       Get Element symbols and characteristic wavelength from DISCUS
        nwave, self.symbols, self.wavelengths = get_wave()
        #
        #       Get Fourier settings from DISCUS
        corners, increment, radiation, bElement, wvle, ener, adp, ano, \
                percent, lot_type, lot_num, lot_dim, lot_per \
                = suite.discus_get_fourier()
        for i in range(4):
            for j in range(3):
                corners[i, j] = round_rbn(corners[i, j], 5)
        wvle = round_rbn(wvle, 5)
        ener = round_rbn(ener, 5)
        #
        #       Determine if an element was given for its characteristic radiation
        Element = bElement.decode()
        ElementNumber = -1
        for i in range(nwave):
            if Element == self.symbols[i]:
                ElementNumber = i
                break

        self.ll_h = tk.StringVar()
        self.ll_k = tk.StringVar()
        self.ll_l = tk.StringVar()
        self.lr_h = tk.StringVar()
        self.lr_k = tk.StringVar()
        self.lr_l = tk.StringVar()
        self.ul_h = tk.StringVar()
        self.ul_k = tk.StringVar()
        self.ul_l = tk.StringVar()
        self.tl_h = tk.StringVar()
        self.tl_k = tk.StringVar()
        self.tl_l = tk.StringVar()
        self.ll_h.set(str(corners[0, 0]))
        self.ll_k.set(str(corners[0, 1]))
        self.ll_l.set(str(corners[0, 2]))
        self.lr_h.set(str(corners[1, 0]))
        self.lr_k.set(str(corners[1, 1]))
        self.lr_l.set(str(corners[1, 2]))
        self.ul_h.set(str(corners[2, 0]))
        self.ul_k.set(str(corners[2, 1]))
        self.ul_l.set(str(corners[2, 2]))
        self.tl_h.set(str(corners[3, 0]))
        self.tl_k.set(str(corners[3, 1]))
        self.tl_l.set(str(corners[3, 2]))
        self.caption = ttk.Label(self,
                                 text='Single crystal Fourier calculations')
        self.label_h = ttk.Label(self, text='H', anchor='center')
        self.label_k = ttk.Label(self, text='K', anchor='center')
        self.label_l = ttk.Label(self, text='L', anchor='center')
        self.label_ll = ttk.Label(self, text='Lower left')
        self.label_lr = ttk.Label(self, text='Lower right')
        self.label_ul = ttk.Label(self, text='Upper left')
        self.label_tl = ttk.Label(self, text='Top left')
        self.entry_ll_h = ttk.Entry(self,
                                    textvariable=self.ll_h,
                                    width=8,
                                    justify='right',
                                    background=COLORS.en_back,
                                    foreground=COLORS.en_fore)
        self.entry_ll_k = ttk.Entry(self,
                                    textvariable=self.ll_k,
                                    width=8,
                                    justify='right',
                                    background=COLORS.en_back,
                                    foreground=COLORS.en_fore)
        self.entry_ll_l = ttk.Entry(self,
                                    textvariable=self.ll_l,
                                    width=8,
                                    justify='right',
                                    background=COLORS.en_back,
                                    foreground=COLORS.en_fore)
        self.entry_lr_h = ttk.Entry(self,
                                    textvariable=self.lr_h,
                                    width=8,
                                    justify='right',
                                    background=COLORS.en_back,
                                    foreground=COLORS.en_fore)
        self.entry_lr_k = ttk.Entry(self,
                                    textvariable=self.lr_k,
                                    width=8,
                                    justify='right',
                                    background=COLORS.en_back,
                                    foreground=COLORS.en_fore)
        self.entry_lr_l = ttk.Entry(self,
                                    textvariable=self.lr_l,
                                    width=8,
                                    justify='right',
                                    background=COLORS.en_back,
                                    foreground=COLORS.en_fore)
        self.entry_ul_h = ttk.Entry(self,
                                    textvariable=self.ul_h,
                                    width=8,
                                    justify='right',
                                    background=COLORS.en_back,
                                    foreground=COLORS.en_fore)
        self.entry_ul_k = ttk.Entry(self,
                                    textvariable=self.ul_k,
                                    width=8,
                                    justify='right',
                                    background=COLORS.en_back,
                                    foreground=COLORS.en_fore)
        self.entry_ul_l = ttk.Entry(self,
                                    textvariable=self.ul_l,
                                    width=8,
                                    justify='right',
                                    background=COLORS.en_back,
                                    foreground=COLORS.en_fore)
        self.entry_tl_h = ttk.Entry(self,
                                    textvariable=self.tl_h,
                                    width=8,
                                    justify='right',
                                    background=COLORS.en_back,
                                    foreground=COLORS.en_fore)
        self.entry_tl_k = ttk.Entry(self,
                                    textvariable=self.tl_k,
                                    width=8,
                                    justify='right',
                                    background=COLORS.en_back,
                                    foreground=COLORS.en_fore)
        self.entry_tl_l = ttk.Entry(self,
                                    textvariable=self.tl_l,
                                    width=8,
                                    justify='right',
                                    background=COLORS.en_back,
                                    foreground=COLORS.en_fore)
        #
        self.label_np = ttk.Label(self, text='Points along axis:')
        self.label_np_a = ttk.Label(self, text='Abscissa')
        self.label_np_o = ttk.Label(self, text='Ordinate')
        self.label_np_t = ttk.Label(self, text='Top axis')
        self.np_aa = tk.StringVar()
        self.np_oo = tk.StringVar()
        self.np_tt = tk.StringVar()
        self.np_aa.set(str(increment[0]))
        self.np_oo.set(str(increment[1]))
        self.np_tt.set(str(increment[2]))
        self.np_a = tk.Spinbox(self,
                               from_=1,
                               to=1001,
                               width=8,
                               justify='right',
                               textvariable=self.np_aa,
                               background=COLORS.en_back,
                               foreground=COLORS.en_fore)
        self.np_o = tk.Spinbox(self,
                               from_=1,
                               to=1001,
                               width=8,
                               justify='right',
                               textvariable=self.np_oo,
                               background=COLORS.en_back,
                               foreground=COLORS.en_fore)
        self.np_t = tk.Spinbox(self,
                               from_=1,
                               to=1001,
                               width=8,
                               justify='right',
                               textvariable=self.np_tt,
                               background=COLORS.en_back,
                               foreground=COLORS.en_fore)
        #
        discus_rad_menu(self, nwave, radiation, wvle, ener, ElementNumber, adp,
                        ano, 1, 4)
        #
        #
        self.Aver = tk.StringVar()
        self.Aver.set(percent)
        self.LabelAver =ttk.Label(self, \
                text='Subtract scattering by average structure sampled at')
        self.EntryAver = ttk.Entry(self,
                                   textvariable=self.Aver,
                                   width=8,
                                   justify='right',
                                   background=COLORS.en_back,
                                   foreground=COLORS.en_fore)
        self.LabelAverPer = ttk.Label(self, text='%')
        #
        #
        self.lot_use = tk.IntVar()
        if lot_type == 0:
            self.lot_use.set(0)
        else:
            self.lot_use.set(1)
        self.label_lot = ttk.Label(self, text='Lots:')
        self.check_lot = ttk.Checkbutton(self,
                                         text='Use',
                                         variable=self.lot_use)
        self.check_lot.bind('<ButtonRelease-1>', self.lot_event)
        #
        self.label_lotshape = ttk.Label(self, text='Lot Shape:')
        self.lot_shape = tk.Listbox(self,
                                    height=2,
                                    width=10,
                                    selectbackground=COLORS.en_back,
                                    selectforeground=COLORS.en_fore,
                                    selectmode=tk.SINGLE)
        self.lot_shape.configure(exportselection=False)
        self.lot_shape.insert(1, 'Box')
        self.lot_shape.insert(2, 'Ellipsoid')
        if lot_type == 1 or lot_type == 0:
            self.lot_shape.selection_set(0)
        elif lot_type == 2:
            self.lot_shape.selection_set(1)
        #
        self.label_lotnum = ttk.Label(self, text='Lot Number:')
        self.lotnn = tk.StringVar()
        self.lotnn.set(str(lot_num))
        self.lotn = tk.Spinbox(self,
                               from_=1,
                               to=1001,
                               width=6,
                               justify='right',
                               textvariable=self.lotnn,
                               background=COLORS.en_back,
                               foreground=COLORS.en_fore)
        #
        self.label_lotdimx = ttk.Label(self, text='Lot Size X:')
        self.label_lotdimy = ttk.Label(self, text='Lot Size Y:')
        self.label_lotdimz = ttk.Label(self, text='Lot Size Z:')
        self.lotxx = tk.StringVar()
        self.lotxx.set(str(lot_dim[0]))
        self.lotyy = tk.StringVar()
        self.lotyy.set(str(lot_dim[1]))
        self.lotzz = tk.StringVar()
        self.lotzz.set(str(lot_dim[2]))
        self.lotx = tk.Spinbox(self,
                               from_=1,
                               to=1001,
                               width=6,
                               justify='right',
                               textvariable=self.lotxx,
                               background=COLORS.en_back,
                               foreground=COLORS.en_fore)
        self.loty = tk.Spinbox(self,
                               from_=1,
                               to=1001,
                               width=6,
                               justify='right',
                               textvariable=self.lotyy,
                               background=COLORS.en_back,
                               foreground=COLORS.en_fore)
        self.lotz = tk.Spinbox(self,
                               from_=1,
                               to=1001,
                               width=6,
                               justify='right',
                               textvariable=self.lotzz,
                               background=COLORS.en_back,
                               foreground=COLORS.en_fore)
        #
        self.label_lot_per = ttk.Label(self, text='Lots:')
        self.lot_per = tk.IntVar()
        if lot_per == 0:
            self.lot_per.set(0)
        else:
            self.lot_per.set(1)
        self.check_lot_per = tk.Checkbutton(self,
                                            text='Periodic',
                                            variable=self.lot_per)
        self.lot_menu(self.lot_use.get())
        #
        #
        self.acc = ttk.Button(
            self,
            text='Run',
            command=lambda: self.calc_fourier(
                parent, corners, increment, radiation, wvle, ener, adp, ano,
                percent, lot_type, lot_num, lot_dim, lot_per))
        #
        #
        self.show = ttk.Button(
            self,
            text='Show',
            command=lambda: self.show_fourier(
                parent, corners, increment, radiation, wvle, ener, adp, ano,
                percent, lot_type, lot_num, lot_dim, lot_per))
        #
        #
        create_exit_button(
            self, 'discus', 11, 8, self.exit_command,
            (parent, corners, increment, radiation, wvle, ener, adp, ano,
             percent, lot_type, lot_num, lot_dim, lot_per))
        #
        #
        self.CExplain = tk.Canvas(self,
                                  bg=COLORS.fr_read,
                                  height=200,
                                  width=400)
        self.CExplain.create_text(20,
                                  20,
                                  text='Calculates an arbitrary line, ',
                                  anchor=tk.W)
        self.CExplain.create_text(20,
                                  35,
                                  text='plane or voxel in reciprocal ',
                                  anchor=tk.W)
        self.CExplain.create_text(20,
                                  50,
                                  text='space. The corners are the ',
                                  anchor=tk.W)
        self.CExplain.create_text(20,
                                  65,
                                  text='lower left, lower right...',
                                  anchor=tk.W)
        self.CExplain.create_text(20,
                                  80,
                                  text='Points include the corners as ',
                                  anchor=tk.W)
        self.CExplain.create_text(20,
                                  95,
                                  text='shown in the schematic drawing.',
                                  anchor=tk.W)
        self.CExplain.create_line(400, 120, 600, 160, width=4)
        self.CExplain.create_line(400, 120, 400, 20, width=4)
        self.CExplain.create_line(400, 120, 500, 60, width=4)
        self.CExplain.create_oval(400 - 5,
                                  120 - 5,
                                  400 + 5,
                                  120 + 5,
                                  fill='black')
        self.CExplain.create_oval(467 - 5,
                                  133 - 5,
                                  467 + 5,
                                  133 + 5,
                                  fill='black')
        self.CExplain.create_oval(533 - 5,
                                  147 - 5,
                                  533 + 5,
                                  147 + 5,
                                  fill='black')
        self.CExplain.create_oval(600 - 5,
                                  160 - 5,
                                  600 + 5,
                                  160 + 5,
                                  fill='black')
        self.CExplain.create_oval(400 - 5,
                                  70 - 5,
                                  400 + 5,
                                  70 + 5,
                                  fill='black')
        self.CExplain.create_oval(400 - 5,
                                  20 - 5,
                                  400 + 5,
                                  20 + 5,
                                  fill='black')
        self.CExplain.create_oval(500 - 5,
                                  60 - 5,
                                  500 + 5,
                                  60 + 5,
                                  fill='black')
        self.CExplain.create_text(390, 120, text='Lower left', anchor=tk.E)
        self.CExplain.create_text(600,
                                  180,
                                  text='Lower right',
                                  anchor=tk.CENTER)
        self.CExplain.create_text(390, 20, text='Upper left', anchor=tk.E)
        self.CExplain.create_text(510, 60, text='Top left', anchor=tk.W)
        self.CExplain.create_text(500,
                                  160,
                                  text='Points along abscissa = 4',
                                  anchor=tk.E)
        self.CExplain.create_text(390,
                                  70,
                                  text='Points along ordinate = 3',
                                  anchor=tk.E)
        #

        ##      # If an Element name was given, make this active
        ##      if ElementNumber > -1:
        ##          self.ele.configure(state='normal')
        ##          self.entry_wvle.configure(state='disabled')
        ##          self.entry_ener.configure(state='disabled')
        ##          self.rad_type.set(2)
        ##      else:
        ##          self.ele.configure(state='disabled')
        ##          self.entry_wvle.configure(state='normal')
        ##          self.entry_ener.configure(state='disabled')
        ##          self.rad_type.set(0)

        self.caption.grid(row=0, column=0, columnspan=8, pady=(10, 10))
        self.label_h.grid(row=1, column=1, sticky='EW')
        self.label_k.grid(row=1, column=2, sticky='EW')
        self.label_l.grid(row=1, column=3, sticky='EW')
        self.label_ll.grid(row=2, column=0, sticky='EW')
        self.label_lr.grid(row=3, column=0, sticky='EW')
        self.label_ul.grid(row=4, column=0, sticky='EW')
        self.label_tl.grid(row=5, column=0, sticky='EW')
        self.entry_ll_h.grid(row=2, column=1, sticky='EW')
        self.entry_ll_k.grid(row=2, column=2, sticky='EW')
        self.entry_ll_l.grid(row=2, column=3, sticky='EW')
        self.entry_lr_h.grid(row=3, column=1, sticky='EW')
        self.entry_lr_k.grid(row=3, column=2, sticky='EW')
        self.entry_lr_l.grid(row=3, column=3, sticky='EW')
        self.entry_ul_h.grid(row=4, column=1, sticky='EW')
        self.entry_ul_k.grid(row=4, column=2, sticky='EW')
        self.entry_ul_l.grid(row=4, column=3, sticky='EW')
        self.entry_tl_h.grid(row=5, column=1, sticky='EW')
        self.entry_tl_k.grid(row=5, column=2, sticky='EW')
        self.entry_tl_l.grid(row=5, column=3, sticky='EW')
        self.label_np.grid(row=6,
                           column=0,
                           pady=(5, 0),
                           columnspan=2,
                           sticky='EW')
        self.label_np_a.grid(row=7, column=0, sticky='EW')
        self.label_np_o.grid(row=8, column=0, sticky='EW')
        self.label_np_t.grid(row=9, column=0, sticky='EW')
        self.np_a.grid(row=7, column=1, columnspan=1, sticky='EW')
        self.np_o.grid(row=8, column=1, columnspan=1, sticky='EW')
        self.np_t.grid(row=9, column=1, columnspan=1, sticky='EW')
        #
        self.LabelAver.grid(row=6, column=3, columnspan=7, sticky='EW')
        self.EntryAver.grid(row=6, column=7, sticky='EW')
        self.LabelAverPer.grid(row=6, column=8, sticky='W')
        self.label_lot.grid(row=7, column=4, sticky='EW')
        self.check_lot.grid(row=7, column=5, sticky='EW')
        self.label_lotshape.grid(row=9, column=3, sticky='EW')
        self.lot_shape.grid(row=9, column=4, rowspan=2, sticky='EW')
        self.label_lotnum.grid(row=11, column=3, sticky='EW')
        self.lotn.grid(row=11, column=4, sticky='EW')
        self.label_lotdimx.grid(row=9, column=5, sticky='EW')
        self.label_lotdimy.grid(row=10, column=5, sticky='EW')
        self.label_lotdimz.grid(row=11, column=5, sticky='EW')
        self.lotx.grid(row=9, column=6, sticky='EW')
        self.loty.grid(row=10, column=6, sticky='EW')
        self.lotz.grid(row=11, column=6, sticky='EW')
        self.label_lot_per.grid(row=8, column=4, sticky='EW')
        self.check_lot_per.grid(row=8, column=5, sticky='EW')
        self.show.grid(row=9, column=8)
        self.acc.grid(row=10, column=8)
        self.CExplain.grid(row=12, column=0, columnspan=9, sticky='EW')
        #
        line = 'fourier'
        suite.suite_learn(line)