本文整理汇总了Python中ScrolledText.tag_delete方法的典型用法代码示例。如果您正苦于以下问题:Python ScrolledText.tag_delete方法的具体用法?Python ScrolledText.tag_delete怎么用?Python ScrolledText.tag_delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScrolledText
的用法示例。
在下文中一共展示了ScrolledText.tag_delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TextEditor
# 需要导入模块: import ScrolledText [as 别名]
# 或者: from ScrolledText import tag_delete [as 别名]
#.........这里部分代码省略.........
def redo(self):
self.textWidget.edit_redo()
def cut(self):
if self.textWidget.tag_ranges("sel"):
self.clipboard = self.textWidget.get("sel.first","sel.last")
self.textWidget.delete("sel.first","sel.last")
else:
self.clipboard = ""
def copy(self):
if self.textWidget.tag_ranges("sel"):
self.clipboard = self.textWidget.get("sel.first","sel.last")
def paste(self):
if self.textWidget.tag_ranges("sel"):
self.textWidget.insert("insert",self.clipboard)
def resetFontAttribute(self):
self.font = tkFont.Font(family = self.currentFont,
size = self.fontSize)
self.textWidget.config(font = self.font)
def increaseFontSize(self):
self.fontSize += 2
self.resetFontAttribute()
def decreaseFontSize(self):
self.fontSize -= 2
self.resetFontAttribute()
def highlightString(self,searchString):
lenSearchString = len(searchString)
self.textWidget.tag_delete("search")
self.textWidget.tag_config("search", background = "#FFE792")
start = 1.0
while True:
pos = self.textWidget.search(searchString, start, stopindex = END)
if(not pos):
break
self.textWidget.tag_add("search", pos, pos+"+%dc"%(lenSearchString))
start = pos + "+1c"
# search highlight color #FFE792
def searchInText(self):
title = "Search"
message = "Enter word to search for"
searchString = tkSimpleDialog.askstring(title,message)
if(searchString == None): return
self.highlightString(searchString)
def commentCode(self):
# puts an annotation in the currently selected text
title = "Comment"
message = "Enter comment for selection"
comment = tkSimpleDialog.askstring(title,message)
if(comment == None): return
if self.textWidget.tag_ranges("sel"):
self.textWidget.tag_add("comment",
self.textWidget.index(SEL_FIRST),
self.textWidget.index(SEL_LAST))
self.textWidget.tag_config("comment", underline = 1)
self.comments += [self.textWidget.index(SEL_FIRST) + "|" +
self.textWidget.index(SEL_LAST) + "|" + comment]
if(self.collaborativeCodingMode):
# can only send strings through socket