本文整理匯總了Python中Tkinter.END屬性的典型用法代碼示例。如果您正苦於以下問題:Python Tkinter.END屬性的具體用法?Python Tkinter.END怎麽用?Python Tkinter.END使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類Tkinter
的用法示例。
在下文中一共展示了Tkinter.END屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: goto_path
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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)
示例2: loadIntoWindow
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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
示例3: generate
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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')
示例4: highlightMatches
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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
示例5: initKimmo
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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()
示例6: capturePrint
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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,''
示例7: __init__
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
def __init__(self, root, resource_dir, lang="fr"):
ttk.Frame.__init__(self, root)
self.resource_dir = resource_dir
self._lang = None
langs = os.listdir(os.path.join(self.resource_dir, "master"))
if langs:
self._lang = (lang if lang in langs else langs[0])
self.items = (os.listdir(os.path.join(self.resource_dir, "master", self._lang)) if self._lang else [])
self.items.sort(key=lambda x: x.lower())
max_length = max([len(item) for item in self.items])
self.select_workflow_label = ttk.Label(root, text=u"select workflow:")
#strVar = tkinter.StringVar()
self.masters = tkinter.Listbox(root, width=max_length+1, height=len(self.items))#, textvariable=strVar)
for item in self.items:
self.masters.insert(tkinter.END, item)
示例8: on_demo_select
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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)
示例9: cb_ok
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
def cb_ok(self, widget=None, data=None):
try:
self.global_scale_factor = float(self._scale.get())
except ValueError:
TkMsgBoxes.showerror("Scale factor error",
"Please enter a valid floating point number for the scale factor!")
return
self.text = self._text_box.get(1.0, Tk.END)
self.preamble_file = self._preamble.get()
try:
self.callback(self.text, self.preamble_file, self.global_scale_factor, self._alignment_tk_str.get(),
self._tex_command_tk_str.get())
except Exception as error:
self.show_error_dialog("TexText Error",
"Error occurred while converting text from Latex to SVG:",
error)
return False
self._frame.quit()
return False
示例10: trun
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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)
示例11: show_mnemonic_gui
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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
示例12: fill_load_listbox
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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
示例13: remove_span
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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()
示例14: x_adjust
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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()
示例15: y_adjust
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import END [as 別名]
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()