def createfileentry(self, parent_frame, fi_text, _def_fi_, f_ex=None): ''' Quite self explanatoy... creates a row in which is possible to search for a file''' file_row = Frame(parent_frame) if f_ex == None: f_ex = ((fi_text, '.' + _def_fi_.split('.')[-1]), ) _f_labels = format_dec([file_row, fi_text], _pack_=False) Efile = Entry(file_row, width=13) Efile.insert('end', _def_fi_) Efile.bind("<Key>", lambda e: "break") # Magic Efile.xview_moveto(1) Bsearch = Button(file_row, image=self.im_file, command=(lambda El=Efile: self.browsefile(El, f_ex))) # Just packing format_dec(_f_labels, _create_=False) Efile.pack(side='left', expand='yes', fill='x') Bsearch.pack(side='right', padx=0, pady=0) file_row.pack(side='top', fill='x', pady=3) # For tracing purposes list appending return Efile
def atomstyle( self): ''' in this case just one, but could be modified to be generic, accepting <row>, <text> and <options>''' a_mainrow= Frame( self) row_fst = Frame( a_mainrow) #from self-ttk import Combobox TEXT2= 'Choose an atom style' format_dec([row_fst, TEXT2]) row_fsep = Frame(row_fst) atom_var = StringVar() atom_style_ddl = Drop_Down_List(row_fsep, textvariable = atom_var, #state="readonly" ) atom_style_ddl['values'] = ('full', 'charge', 'molecular', 'angle', 'bond','atomic') atom_style_ddl.bind("<Key>", lambda e: "break") # Magic atom_style_ddl.pack() self.objt_c.append( atom_var) row_fsep.pack(side='left', fill='x', pady=0) # row packing row_fst.pack(side='left', pady=0) a_mainrow.pack(side='top', fill='x', pady=3)
def createWidgets(self): '''creates the row content and stores the objects ''' # INIT file_row = Frame(self) fi_text = self.entries_txt _def_file_ = self.entries_val f_ext_txt = () for i in range(len(self.file_ext)): f_ext_txt += ((self.fex_description[i], self.file_ext[i]), ) # Building _f_labels = format_dec([file_row, fi_text], _pack_=False) self._entry = Entry(file_row, width=13, textvariable=self._strvar) self._entry.insert('end', _def_file_) self._entry.bind("<Key>", lambda e: "break") # Magic self._entry.xview_moveto(1) self._button = Button( file_row, image=self.file_img, command=(lambda El=self._entry: self.browsefile(El, f_ext_txt))) # Just packing format_dec(_f_labels, _create_=False) self._entry.pack(side='left', expand='yes', fill='x') self._button.pack(side='right', padx=0, pady=0) file_row.pack(side='top', fill='x', pady=3)
def radio_part(self, _s_row_, _text_, _desc_=[''], _vals_=[]): _f_labels = format_dec([_s_row_, _text_])#, _pack_=False) radio_var = IntVar() for d in range( len( _desc_)): label_rb = Radiobutton(_s_row_, width=0, text= _desc_[d] ,variable = radio_var , value= len( _desc_)-1-d ,command = self.solvastuff , anchor='w' ) label_rb.pack(side='left', padx=6) self.objt_c.append( radio_var)
def autoloadff(self): ''' function that enables the autoload of the forcefield files as stated in the top file, also as a logic side effect disables the file load option for forcefields ''' _a_row_ = Frame(self) _text_ = 'Autoload forcefield files' bt_txt_ = 'Press to autoload' _f_labels = format_dec([_a_row_, _text_]) self.autol_b = Button( _a_row_, text=bt_txt_, #width = 25, height=23, command=self.autoloadstuff) self.autol_b.pack(padx=0) #side='center', _a_row_.pack(side='top', fill='x', pady=3)