I'm trying to use the tkinter Text widget to implement some basic text formatting features. Bold, Underline, Italic, and a few font sizes.
I've got each of these things working by itself from this example Add advanced features to a tkinter Text widget but I'm finding that any formatting which uses the font keyword is mutually exclusive from any other that uses the font keyword.
For example: To implement "bold", I pre-create a tag which copies the default font of the text box, changes it to be bold, and then uses that as the font= argument of tag_configure. I do italic the same way, and also different font sizes. I don't see an easy way to have a "bold" button which when clicked will make the selected text bold, but keep all other features of its font (if it was previously made size 18 for example).
Is there any better way than pre-creating all possible combinations of font tags, and having a bunch of logic that decides which one(s) to apply to a selected section of text when a formatting button is clicked?