Python Tkinter.END Examples

The following are 30 code examples of Tkinter.END(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module Tkinter , or try the search function .
Example #1
Source File: kimmo.py    From razzy-spinner with GNU General Public License v3.0 6 votes vote down vote up
def initKimmo(self, *args):
		"""
		Initialize the Kimmo engine from the lexicon.  This will get called no matter generate
		or recognize.  (i.e. loading all rules, lexicon, and alternations
		"""
	        # only initialize Kimmo if the contents of the *rules* have changed
		tmprmd5 = md5.new(self.rules.get(1.0, Tkinter.END))
		tmplmd5 = md5.new(self.lexicon.get(1.0, Tkinter.END))
		if (not self.kimmoinstance) or (self.rulemd5 != tmprmd5) or (self.lexmd5 != tmplmd5):
			self.guiError("Creating new Kimmo instance")
			self.kimmoinstance = KimmoControl(self.lexicon.get(1.0, Tkinter.END),self.rules.get(1.0, Tkinter.END),'','',self.debug)
			self.guiError("")
			self.rulemd5 = tmprmd5
			self.lexmd5 = tmplmd5

		if not self.kimmoinstance.ok:
			self.guiError("Creation of Kimmo Instance Failed")
			return
		if not self.kimmoinstance.m.initial_state() :
			self.guiError("Morphology Setup Failed")
		elif self.kimmoinstance.errors:
			self.guiError(self.kimmoinstance.errors)
			self.kimmoinstance.errors = ''
		# self.validate() 
Example #2
Source File: demo.py    From OpenCV-Python-Tutorial with MIT License 6 votes vote down vote up
def on_demo_select(self, evt):
        name = self.demos_lb.get( self.demos_lb.curselection()[0] )
        fn = self.samples[name]
        loc = {}
        if PY3:
            exec(open(fn).read(), loc)
        else:
            execfile(fn, loc)
        descr = loc.get('__doc__', 'no-description')

        self.linker.reset()
        self.text.config(state='normal')
        self.text.delete(1.0, tk.END)
        self.format_text(descr)
        self.text.config(state='disabled')

        self.cmd_entry.delete(0, tk.END)
        self.cmd_entry.insert(0, fn) 
Example #3
Source File: Frame_2D_GUI.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def fill_load_listbox(self,*event):
        self.b_solve_frame.configure(state=tk.DISABLED, bg='red3')
        self.frame_solved = 0

        self.load_listbox.delete(0,tk.END)

        color = "pale green"
        i=0
        for x in self.gui_load_list:
            self.load_listbox.insert(tk.END,'{0},{1:.3f},{2:.3f},{3:.3f},{4:.3f},{5},{6}'.format(x[0],x[1],x[2],x[3],x[4],x[5],x[6]))

            if i % 2 == 0:
                self.load_listbox.itemconfigure(i, background=color)
            else:
                pass
            i+=1 
Example #4
Source File: Section_Props_GUI.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def x_adjust(self):
        x=[]
        y=[]      
        if self.lb_coords.size()==0:
            pass
        elif self.shift_x_entry.get()=='':
            self.label_error.configure(text = 'Input X amount to Shift')
        else:
            coords_raw = self.lb_coords.get(0,tk.END)
            for line in coords_raw:            
                coords = line.split(',')
                x.append(float(coords[0])+float(self.shift_x_entry.get()))
                y.append(float(coords[1]))
                for i in range(len(x)):
                    new_coords = '{0:.3f},{1:.3f}'.format(x[i],y[i])
                    self.lb_coords.delete(i)
                    self.lb_coords.insert(i,new_coords)
            self.refreshFigure()
            self.ins_validate() 
Example #5
Source File: Section_Props_GUI.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def y_adjust(self):
        x=[]
        y=[]      
        if self.lb_coords.size()==0:
            pass
        elif self.shift_y_entry.get()=='':
            self.label_error.configure(text = 'Input Y amount to Shift')
        else:
            coords_raw = self.lb_coords.get(0,tk.END)
            for line in coords_raw:            
                coords = line.split(',')
                x.append(float(coords[0]))
                y.append(float(coords[1])+float(self.shift_y_entry.get()))
                for i in range(len(x)):
                    new_coords = '{0:.3f},{1:.3f}'.format(x[i],y[i])
                    self.lb_coords.delete(i)
                    self.lb_coords.insert(i,new_coords)
            self.refreshFigure()
            self.ins_validate() 
Example #6
Source File: Section_Props_GUI.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def refreshFigure(self):
        x=[]
        y=[]
        
        if self.lb_coords.size()==0:
            pass
        else:            
            coords_raw = self.lb_coords.get(0,tk.END)
            for line in coords_raw:
                coords = line.split(',')
                x.append(float(coords[0]))
                y.append(float(coords[1]))
            
            self.line1.set_data(x,y)
            ax = self.canvas.figure.axes[0]
            ax.set_xlim(min(x)-0.5, max(x)+0.5)
            ax.set_ylim(min(y)-0.5, max(y)+0.5)        
            self.canvas.draw() 
Example #7
Source File: Frame_2D_GUI_metric.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def fill_load_listbox(self,*event):
        self.b_solve_frame.configure(state=tk.DISABLED, bg='red3')
        self.frame_solved = 0

        self.load_listbox.delete(0,tk.END)

        color = "pale green"
        i=0
        for x in self.gui_load_list:
            self.load_listbox.insert(tk.END,'{0},{1:.3f},{2:.3f},{3:.3f},{4:.3f},{5},{6}'.format(x[0],x[1],x[2],x[3],x[4],x[5],x[6]))

            if i % 2 == 0:
                self.load_listbox.itemconfigure(i, background=color)
            else:
                pass
            i+=1 
Example #8
Source File: concrete_T_beam_any_steel_gui.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def remove_bottom_bars(self):
        self.bottom_bars.delete(tk.END)
        self.bottom_bars_count.delete(tk.END)
        self.bottom_bars_d.delete(tk.END)
        self.bottom_bars_as.delete(tk.END)
        self.clear_bar_res_lists()
        
        if self.bottom_bars.size()==0:
            self.brun.configure(state="disabled")
            self.b_bottom_change.configure(state= "disable")
            self.error_check = 0
        else:
            self.brun.configure(state="normal")
            self.b_bottom_change.configure(state= "disable")
            self.error_check = 0
            self.run_file() 
Example #9
Source File: btcrseed.py    From btcrecover with GNU General Public License v2.0 6 votes vote down vote up
def show_mnemonic_gui(mnemonic_sentence):
    """may be called *after* main() to display the successful result iff the GUI is in use

    :param mnemonic_sentence: the mnemonic sentence that was found
    :type mnemonic_sentence: unicode
    :rtype: None
    """
    assert tk_root
    global pause_at_exit
    padding = 6
    tk.Label(text="WARNING: seed information is sensitive, carefully protect it and do not share", fg="red") \
        .pack(padx=padding, pady=padding)
    tk.Label(text="Seed found:").pack(side=tk.LEFT, padx=padding, pady=padding)
    entry = tk.Entry(width=80, readonlybackground="white")
    entry.insert(0, mnemonic_sentence)
    entry.config(state="readonly")
    entry.select_range(0, tk.END)
    entry.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=padding, pady=padding)
    tk_root.deiconify()
    tk_root.lift()
    entry.focus_set()
    tk_root.mainloop()  # blocks until the user closes the window
    pause_at_exit = False 
Example #10
Source File: concrete_T_beam_gui.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def add_bottom_bars(self):
        if self.section_created == 1:
            number_of_bars = self.section_bottom_bar.get()
            if number_of_bars == '':
                self.label_error.configure(text = 'Error! : Enter number of bottom bars')
                self.error_check = 1
            else:
                number_of_bars = float(self.section_bottom_bar.get())
                self.error_check = 0

            if number_of_bars > self.max_bottom_bars_per_Layer:
                self.label_error.configure(text = 'Error! : Limit number of bottom bars to max')
                self.error_check = 1
            else:
                self.bottom_bars.insert(tk.END,self.section_bottom_bar_size.get())
                self.bottom_bars_count.insert(tk.END,self.section_bottom_bar.get())
                self.brun.configure(state="normal")
                self.clear_bar_res_lists()
                self.error_check = 0
                self.run_file()
        else:
            pass 
Example #11
Source File: kimmo.py    From razzy-spinner with GNU General Public License v3.0 6 votes vote down vote up
def capturePrint(self,*args):
    	# self.debugWin.set(string.join(args," "))
    	
    	# if there is a trace/debug window
    	if self.dbgTracing:
    		self.traceWindow.insert(Tkinter.END, string.join(args," "))
    		self.traceWindow.see(Tkinter.END)
    		
    	
    	# otherwise, just drop the output.
    	
    	# no no, if tracing is on, but no window, turn tracing off and cleanup window
    	
    	# !!! if tracing is on, but window is not defined, create it.
    		# this will cause a post-recover from an improper close of the debug window
    		
    	# if tracing is not on, ignore it.
    	
    	# return 1,1,'Out Hooked:'+text
    	return 0,0,'' 
Example #12
Source File: kimmo.py    From razzy-spinner with GNU General Public License v3.0 6 votes vote down vote up
def highlightMatches(self, word, window,color):
    	# assumes unbroken with whitespace words.
    	if not word: return
    	
    	matchIdx = '1.0'
    	matchRight = '1.0'
    	while matchIdx != '':
    		matchIdx = window.search(word,matchRight,count=1,stopindex=Tkinter.END)
    		if matchIdx == '': break
    		
    		strptr = matchIdx.split(".")
    		matchRight = strptr[0] + '.' + str((int(strptr[1],10) + len(word)))

    		window.tag_add(self.tagId, matchIdx, matchRight )
    		window.tag_configure(self.tagId,background=color, foreground='black')
    		self.highlightIds.append([window,self.tagId])
    		self.tagId = self.tagId + 1
    	
    	

# INIT KIMMO 
Example #13
Source File: kimmo.py    From razzy-spinner with GNU General Public License v3.0 6 votes vote down vote up
def generate(self, *args):
        if self._root is None: return

        if len(self.wordIn.get()) > 0:
	        self.initKimmo()
	
	        tmpword = self.wordIn.get()

	        tmpword.strip()
	
	        # generate_result = _generate_test(self.ks, tmpword)
	        generate_result = self.kimmoinstance.generate(tmpword)
	        generate_result_str = ''
	        # convert list to string
	        for x in generate_result: generate_result_str = generate_result_str + x
	        generate_result_str = generate_result_str + '\n'
	        self.results.insert(1.0, generate_result_str)
	
	        if self.dbgTracing:
    			self.highlightMatches('    BLOCKED',self.traceWindow,'#ffe0e0')	
    			self.highlightMatches('      AT END OF WORD',self.traceWindow,'#e0ffe0')	
    			self.highlightMatches('SUCCESS!',self.traceWindow,'#e0ffe0') 
Example #14
Source File: beam_patterning.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def remove_span(self):
        self.lb_spans.delete(tk.END)
        self.lb_I.delete(tk.END)
        if self.e_span.get()=='' or self.lb_spans.size()==1:
            self.load_span.set(1)
            self._reset_option_menu([1])
            if self.e_span.get()=='':
                for widget in self.displace_widget:
                    widget.destroy()
                del self.displace_widget[:]
            else:
                self.displace_widget[-1].destroy()
                del self.displace_widget[-1]
        else:
            self._reset_option_menu(range(1,self.lb_spans.size()+1))
            self.displace_widget[-1].destroy()
            del self.displace_widget[-1]

        self.ins_validate() 
Example #15
Source File: kimmo.py    From razzy-spinner with GNU General Public License v3.0 6 votes vote down vote up
def loadIntoWindow(self, filename, windowField):
        "Load rule/lexicon set from a text file directly into the window pane specified"
        # filename = args[0]
        # windowField = args[1]

        if filename:
	        filename = os.path.expanduser(filename)
	        f = read_kimmo_file(filename, self)
	        lines = f.readlines()
	        f.close()

	        text = []
	        for line in lines:
	            line = line.strip()
	            text.append(line)

	        # empty the window now that the file was valid
	        windowField.delete(1.0, Tkinter.END)
	
	        windowField.insert(1.0, '\n'.join(text))
	
	        return filename
        return ''	

    	# opens a load dialog for files of a specified type to be loaded into a specified window 
Example #16
Source File: viewer.py    From networkx_viewer with GNU General Public License v3.0 6 votes vote down vote up
def goto_path(self, event):
        frm = self.node_entry.get()
        to = self.node_entry2.get()
        self.node_entry.delete(0, tk.END)
        self.node_entry2.delete(0, tk.END)

        if frm == '':
            tkm.showerror("No From Node", "Please enter a node in both "
                "boxes to plot a path.  Enter a node in only the first box "
                "to bring up nodes immediately adjacent.")
            return

        if frm.isdigit() and int(frm) in self.canvas.dataG.nodes():
            frm = int(frm)
        if to.isdigit() and int(to) in self.canvas.dataG.nodes():
            to = int(to)

        self.canvas.plot_path(frm, to, levels=self.level) 
Example #17
Source File: scdiff_gui.py    From scdiff with MIT License 6 votes vote down vote up
def trun(self):
		#pdb.set_trace()
		self.o=self.ev1.get()
		#pdb.set_trace()
		python=sys.executable
		proc = subprocess.Popen([python,'scdiff.py','-i',self.fileName,'-t',self.TFName,'-k',self.KName,'-o',self.o],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
		
		ct=0
		maxCT=10000
		self.textarea1.insert(tk.INSERT,"starting...")
		self.textarea1.see(tk.END)
		for line in iter(proc.stdout.readline,''):
			self.textarea1.insert(tk.INSERT,line)
			self.textarea1.see(tk.END)
			self.updateProgress(maxCT,ct)
			ct+=1
			self.textarea1.update_idletasks()
		self.updateProgress(maxCT,maxCT)
		
		proc.stdout.close()
		proc.wait()
		self.textarea1.insert(tk.INSERT,"end!")
		self.textarea1.see(tk.END) 
Example #18
Source File: concrete_T_beam_gui.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def clear_bar_res_lists(self, *kwargs):
            self.bottom_bars_as.delete(0,tk.END)
            self.bottom_bars_d.delete(0,tk.END)
            self.bottom_bars_strain.delete(0,tk.END)
            self.bottom_bars_stress.delete(0,tk.END)
            self.bottom_bars_axial.delete(0,tk.END)
            self.bottom_bars_moment.delete(0,tk.END)
            self.top_bars_as.delete(0,tk.END)
            self.top_bars_d.delete(0,tk.END)
            self.top_bars_strain.delete(0,tk.END)
            self.top_bars_stress.delete(0,tk.END)
            self.top_bars_axial.delete(0,tk.END)
            self.top_bars_moment.delete(0,tk.END) 
Example #19
Source File: beam_patterning.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def base(self):
        self.combo_list.delete(0,tk.END)
        for i in range(len(self.load_types)):
            if Main_window.load_exist[i]==0:
                self.combo_list.insert(tk.END, self.load_types[i]+'- N/A')
            else:
                self.combo_list.insert(tk.END, self.load_types[i])
        self.combo_list.insert(tk.END, 'Support Displacement')
        self.s.config(state='normal')
        self.d.config(state='normal')
        self.combo_list.selection_set(0)
        self.pattern_list.selection_set(0) 
Example #20
Source File: beam_patterning.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def print_ins(self):
        if self.lb_spans.size() == 0 or self.lb_I.size()==0 or self.lb_loads.size()==0:
            pass
        else:
            p_loads = self.lb_loads.get(0,tk.END)
            p_spans = self.lb_spans.get(0,tk.END)
            p_I = self.lb_I.get(0,tk.END)
            p_E = self.e_E.get()

            label = self.e_bminfo.get()
            Main_window.calc_label = label
            path = os.path.join(os.path.expanduser('~'),'Desktop','RESULTS', label)

            path_exists(path)
            sup_disp = '' 
            for widget in self.displace_widget:            
                sup_disp = sup_disp + '{0},'.format(widget.get())
            sup_disp = sup_disp[:-1]

            file = open(os.path.join(path,label + '_00_beam_info.txt'),'w')
            file.write(label + '\n')
            file.write('L_ft')
            for line in p_spans:
                file.write(','+line)
            file.write('\nI_in4')
            for line in p_I:
                file.write(','+line)
            file.write('\nE_ksi,'+p_E+'\ncant,'+self.cant_in.get()+'\n'+sup_disp+'\n**Loads**\n''p1(kips or klf)'',''p2(kips or klf)'',a,b,''POINT,UDL,TRAP'' **Do Not Delete This Line, Caps Matter for Load Type**,span\n')
            for line in p_loads:
                file.write(line + '\n')
            file.close()

            self.brun.configure(state="normal", bg='yellow')
            self.bprint.configure(state="normal", bg='green')
            self.menu.entryconfig(3, state="normal") 
Example #21
Source File: beam_patterning.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_load(self):
        load_test = self.load_input_validation()
        
        if load_test == 0:
            pass
        else:
            load = '{0},{1},{2},{3},{4},{5},{6},{7}'.format(self.e_p.get(),self.e_w2.get(),self.e_a.get(),self.e_b.get(),self.load_type.get(),self.load_span.get(),self.load_kind.get(),self.l_pattern_var.get())
            self.lb_loads.insert(tk.END,load)

        self.ins_validate() 
Example #22
Source File: concrete_T_beam_gui.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def remove_top_bars(self):
        self.top_bars.delete(tk.END)
        self.top_bars_count.delete(tk.END)
        self.clear_bar_res_lists()
        self.error_check = 0
        self.b_top_change.configure(state= "disable")

        if self.bottom_bars.size()==0:
            pass
        else:
            self.run_file() 
Example #23
Source File: Section_Props_GUI.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def remove_coord(self):
    
        self.lb_coords.delete(tk.END)
    
        self.ins_validate()
        self.refreshFigure() 
Example #24
Source File: beam_patterning.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def asd(self):
        self.combo_list.delete(0,tk.END)
        for i in range(0,len(self.asd_combos)):
            combo = self.asd_combos[i] + ' - '
            for y in range(0,len(self.load_types)):
                if Main_window.basic_factors[i][y] == 0.0 or Main_window.load_exist[y]==0:
                    pass
                else:        
                    combo = combo + ' {0:.2f}*{1} +'.format(Main_window.basic_factors[i][y],self.load_types[y])
            self.combo_list.insert(tk.END, combo[:-1])
        self.combo_list.insert(tk.END, 'ASD/Basic Envelope')
        self.s.config(state='normal')
        self.d.config(state='normal')
        self.combo_list.selection_set(0)
        self.pattern_list.selection_set(0) 
Example #25
Source File: strap_beam_gui.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def fill_case_list(self, *args):
        self.load_case_res_listbox.delete(0,tk.END)
        self.load_case_listbox.delete(0,tk.END)
        
        self.load_case_res_list = []
        
        for case in self.load_case_list:
            string = '{0},{1},{2},{3},{4},{5},{6}'.format(case[0],case[1],case[2],case[3],case[4],case[5],case[6])
            self.load_case_listbox.insert(tk.END,string)
            
            if case[0] % 2 == 0:
                self.load_case_listbox.itemconfigure(case[0]-1, background='pale green')
            else:
                pass 
Example #26
Source File: nsf2x.py    From nsf2x with GNU General Public License v2.0 5 votes vote down vote up
def log(self, errlvl, message="", newline=True):
        """Error logging function"""
        if errlvl == ErrorLevel.NORMAL:
            if self.ErrorLevel.get() >= ErrorLevel.NORMAL:
                message = _("INFO : ") + message
            else:
                return
        elif errlvl == ErrorLevel.ERROR:
            if self.ErrorLevel.get() >= ErrorLevel.ERROR:
                message = _("ERROR : ") + message
            else:
                return
        elif errlvl == ErrorLevel.WARN:
            if self.ErrorLevel.get() >= ErrorLevel.WARN:
                message = _("WARN : ") + message
            else:
                return
        elif errlvl == ErrorLevel.INFO:
            if self.ErrorLevel.get() >= ErrorLevel.INFO:
                message = _("INFO : ") + message
            else:
                return
        else:
            message = _("ERROR : Unrecognised Error Level given to log function")

        self.messageWidget.config(state=tkinter.NORMAL)
        if newline:
            self.messageWidget.insert(tkinter.END, message+"\n")
        else:
            self.messageWidget.insert(tkinter.END, message)
        self.messageWidget.config(state=tkinter.DISABLED)
        self.messageWidget.yview(tkinter.END)
        self.update() 
Example #27
Source File: nsf2x.py    From nsf2x with GNU General Public License v2.0 5 votes vote down vote up
def bindEntry(self, dummy_event=None):
        """Blank the password field and set it in password mode"""
        self.entryPassword.delete(0, tkinter.END)
        self.entryPassword.config(show="*")
        self.entryPassword.unbind("<FocusIn>") #not needed anymore
        self.unchecked() 
Example #28
Source File: tkconch.py    From learn_python3_spider with MIT License 5 votes vote down vote up
def addForward(self):
        port = self.forwardPort.get()
        self.forwardPort.delete(0, Tkinter.END)
        host = self.forwardHost.get()
        self.forwardHost.delete(0, Tkinter.END)
        if self.localRemoteVar.get() == 'local':
            self.forwards.insert(Tkinter.END, 'L:%s:%s' % (port, host))
        else:
            self.forwards.insert(Tkinter.END, 'R:%s:%s' % (port, host)) 
Example #29
Source File: tkconch.py    From learn_python3_spider with MIT License 5 votes vote down vote up
def getIdentityFile(self):
        r = tkFileDialog.askopenfilename()
        if r:
            self.identity.delete(0, Tkinter.END)
            self.identity.insert(Tkinter.END, r) 
Example #30
Source File: scdiff_gui.py    From scdiff with MIT License 5 votes vote down vote up
def isInputValid(self):
		flag=0
		# check if expression file exists
		if os.path.isfile(self.fileName):
			flag+=1
		else:
			self.textarea1.insert(tk.INSERT,'\nError: Input single Cell Expression data not found!\n')
			self.textarea1.see(tk.END)
			self.textarea1.update_idletasks()

		# check if K valid
		if self.vk1.get()==0:
			flag+=1
		elif self.vk1.get()==1:
			if os.path.isfile(self.KName):
				flag+=1
			else:
				self.textarea1.insert(tk.INSERT,'\nError: User-defined Optimal Number of Clusters K file not found!\n')
				self.textarea1.see(tk.END)
				self.textarea1.update_idletasks()
		
		# check if output name valid
		try: 
			if os.path.exists(self.ev1.get())==False:
				os.mkdir(self.ev1.get())
			flag+=1
		except:
			self.textarea1.insert(tk.INSERT,'\nError: Output folder name invalid!\n')
			self.textarea1.see(tk.END)
			self.textarea1.update_idletasks()
				
		#pdb.set_trace()
		if flag>=3:
			return True
		return False