Skip to content

Instantly share code, notes, and snippets.

View paulokanda's full-sized avatar

Paulo Kanda paulokanda

View GitHub Profile
@perseoq
perseoq / perseoq34.py
Last active September 14, 2022 14:32
Insert HTML tag in a selected text / tkinter (Text Widget) / [Replace text selected with new text]
def bold(self):
selexion = self.mensaje.get(SEL_FIRST, SEL_LAST) # get original string
rpl = " <p>" + selexion + "</p> " # costruct new string
self.mensaje.insert(INSERT,rpl) # insert new string
self.mensaje.delete(SEL_FIRST,SEL_LAST) # delete old string
return