def uoff(event): global _i buf = editor.buffer() tagname = 'underline.underline-%d' % _i _i += 1 buf.tag_config(tagname, underline=False) buf.tag_add(tagname, 'sel.first', 'sel.last')
def uon(event): global _i print("hi") buf = editor.buffer() tagname = 'underline.underline-%d' % _i _i += 1 buf.tag_config(tagname, underline=True) buf.tag_add(tagname, 'sel.first', 'sel.last')
def quit(): for i in editor.tabs(): editor.select(i) buf = editor.buffer() #print("DEBUG: buf.path => |%s|" % buf.path) if buf.is_untitled and buf.text not in '\n' and _asksavep(): save() root.destroy()
def save(event=None): buf = editor.buffer() if buf.is_untitled: path = asksaveasfilename() # If the user clicked 'Cancel', return without changing anything. if not path: return buf.path = path buf.flush() editor.update_titlebar() editor.update_tabs()
def _asksavep(): return askyesno("Save?", "Save %s?" % editor.buffer().path)
def fgcolor(event): color_code = askcolor()[1] # Ex. '#00cc00' if not color_code: return tagname = 'color.fgcolor-%s' % color_code # Ex: 'color.fgcolor-#00cc00' editor.buffer().tag_config(tagname, foreground=color_code) editor.buffer().tag_add(tagname, 'sel.first', 'sel.last')
def bgcolor(event): color_code = askcolor()[1] if not color_code: return tagname = 'color.bgcolor-%s' % color_code editor.buffer().tag_config(tagname, background=color_code) editor.buffer().tag_add(tagname, 'sel.first', 'sel.last')
def fgcolor(event): color_code = askcolor()[1] # Ex. '#00cc00' if not color_code: return tagname = 'color.fgcolor-%s' % color_code# Ex: 'color.fgcolor-#00cc00' editor.buffer().tag_config(tagname, foreground=color_code) editor.buffer().tag_add(tagname, 'sel.first', 'sel.last')