1from tkinter import font
2def bolder():
3 bold_font=font.Font(my_text,my_text.cget("font")) #my_text is text box variable name
4 bold_font.configure(weight="bold")
5
6 my_text.tag_configure("bold",font=bold_font)
7
8 current_tags=my_text.tag_names("sel.first")
9
10 if "bold" in current_tags:
11 my_text.tag_remove("bold","sel.first","sel.last")
12 else:
13 my_text.tag_add("bold","sel.first","sel.last")
14