Reputation: 3
I would like to display a list of about 2500 fonts with 2 columns. Column 1 with the font name and column 2 with a sample text styled with the font named in column 1 for that row.
I am trying to use tkinter treeview to do this. I saw a similar question asked here but the answer that was given only applied to column headers.
I am also open to suggestions for other widget structures to accomplish this.
Upvotes: 0
Views: 999
Reputation: 6820
for font_name in font_list:
# create a tag for each font name in the list
# the name of the font is the name of the tag
my_treeview.tag_configure(font_name, font=font_name)
# insert items into the treeview using the font_name tags
my_treeview.insert(
'',
tk.END,
values=(font_name, sample_text),
tags=[font_name]
)
# the caveat here is that both columns will be in the new font
Upvotes: 0