Basic example of tkinter ttk treeview with alternating row colors and styles text
Python:
# Do the imports
import tkinter as tk
from tkinter import ttk, font
# Initiate the root window
root = tk.Tk()
# Setting min size
root.minsize(400,300)
# Get some data for inserting
fonts = list(font.families())
fonts.sort()
# Name the columns
columns = ('fonts')
# Configuring for fonts
s = ttk.Style()
s.configure('AStyle.Treeview', rowheight=35)
# Create the treeview
tree = ttk.Treeview(root, columns=columns, show='headings', style='AStyle.Treeview')
# The tree headers
tree.heading('fonts', text='Fonts')
tree.pack(side='left', fill='both', expand='yes')
# Configure tags for alternating colors
tree.tag_configure('odd', background='lightblue')
tree.tag_configure('even', background='skyblue')
# Create the scrollbar
scrollbar = ttk.Scrollbar(root, orient='vertical', command=tree.yview)
tree.configure(yscrollcommand=scrollbar.set)
scrollbar.pack(side='right', fill='y')
# Loop through data for inserting
for index, font in enumerate(fonts):
# Configure fonts for display and insert data
tree.tag_configure(str(font), font=(str(font), 14, 'normal'))
if index % 2 == 0:
tree.insert('', 'end', values=font, tags=('even', font,))
else:
tree.insert('', 'end', values=font, tags=('odd', font, ))
root.mainloop()