I have a table with 4 columns that are read from csv and displayed using tkinter. I want to a checkbutton at the end of every row in the column called 'Served'. However instead of getting a checkbutton I get '.!framed.!checkbut'.
Here is my code:
from tkinter import *
from tkinter import ttk
from ttkthemes import ThemedStyle
import tkinter.font as font
import csv
root = Tk()
root.title("A") #title shown in bar
root.iconbitmap(r'C:/Users/...') #icon shown in bar
TableMargin = ttk.Frame(root)
TableMargin.grid(column=0, row=0, sticky=(N, W, E, S))
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
root.state('zoomed') #fullscreen
# Setting Theme
style = ThemedStyle(TableMargin)
style.set_theme("black")
#Heading
label = ttk.Label(TableMargin, text='Orders')
label['font'] = font.Font(size=20, weight="bold")
label.grid(row=0, sticky=(N),pady=5)
#Designing of Table
style = ttk.Style()
style.configure("Treeview.Heading", font=(None, 13))
# scrollbarx = Scrollbar(TableMargin, orient=HORIZONTAL)
# scrollbary = Scrollbar(TableMargin, orient=VERTICAL)
tree = ttk.Treeview(TableMargin, columns=("Table No.", "Order", "Time", "Served"), height=400, selectmode="extended") #, yscrollcommand=scrollbary.set, xscrollcommand=scrollbarx.set
# scrollbary.config(command=tree.yview)
# scrollbary.pack(side=RIGHT, fill=Y)
# scrollbarx.config(command=tree.xview)
# scrollbarx.pack(side=BOTTOM, fill=X)
tree.heading('Table No.', text="Table No.", anchor=W)
tree.heading('Order', text="Order", anchor=W)
tree.heading('Time', text="Time", anchor=W)
tree.heading('Served', text="Served", anchor=W)
tree.column('#0', stretch=NO, minwidth=0, width=0)
tree.column('#1', stretch=NO, minwidth=0, width=100)
tree.column('#2', stretch=NO, minwidth=0, width=600)
tree.column('#3', stretch=NO, minwidth=0, width=100)
tree.column('#4', stretch=NO, minwidth=0, width=100)
tree.grid(row=0, pady=50,padx=190,sticky=(N, E, S))
with open('C:/Users/...', encoding = "utf-8-sig") as f:
reader = csv.DictReader(f, delimiter=',')
for row in reader:
table = row['Table']
order = row['Order']
time = row['Time']
var = IntVar()
served = ttk.Checkbutton(TableMargin, text="", variable=var)
served.grid()
tree.insert("", 1, values=(table, order, time, served))