Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change font style for part of a tkinter label

I'm wondering how I can change the font of a Python Tkinter label widget so that half the displayed text is bold and half is not without having to use two labels. The text for the widget is assigned prior to the label actually being created and stored in a variable so I need some kind of flag presumably to tell it how much of the string should be bold. I don't it is possible but suggestions appreciated.

like image 893
Ilmiont Avatar asked Oct 24 '25 19:10

Ilmiont


1 Answers

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.

like image 95
Bryan Oakley Avatar answered Oct 26 '25 08:10

Bryan Oakley