Reputation: 79
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?
Upvotes: 4
Views: 5429
Reputation: 721
from Tkinter import *
import tkFont
sf= tkFont.Font(family='Helvetica', size=36, weight='bold')
lb = Listbox(root , bd=1, height=10, font=sf)
Upvotes: 2
Reputation: 315
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.
Upvotes: 2