How to change font style for part of a tkinter label
There is nothing you can do with the label widget -- it only supports a single font and single color for the entire label. However, you can easily substitute a canvas or text widget anywhere you need this feature. There's no reason why you can't use a text widget that is one line tall and a dozen or so characters wide.
I don't think there's an out-of-the-box method for changing the font within a label, but you could make a custom label type to handle it, for example:
def customLabel(parent, row, column, bold, standard): cLabelFrame = Frame(parent) cLabelFrame.grid(row=row, column=column) Label(cLabelFrame, text=bold, font=('bold').grid(column=0) Label(cLabelFrame, text=standard).grid(column=1)
Where the arguments: parent
is the containing frame, bold
is your bold text, and standard
is the regular text. You'd have to figure out where to split your original string and assign it to the bold
and standard
args.