Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python tkinter lisbox bold

I am trying to bold all of the entries for my python tkinter listbox.

I have a list and it enters it into a listbox:

listbox4.insert(END, Words) Does anyone know the code to bold these entries?

like image 314
Alex Weinstein Avatar asked Oct 22 '25 12:10

Alex Weinstein


1 Answers

you can configure the Font used by the listbox object for all of the text

assuming you are using python 3 and tkinter the code would be like follows (replace the import line with import tkFont on python 2)

from tkinter import font

listbox4.insert(END, Words)
bolded = font.Font(weight='bold') # will use the default font
listbox4.config(font=bolded)

see here for some more tkFont documentation in case you want to change the font-family, size, etc.

like image 107
pussinboots Avatar answered Oct 24 '25 03:10

pussinboots



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!