Overwriting tkinter labels in gridview

42 Views Asked by At

Trying to make a dashboard using excel as backend which displays the data associated to the selected value; approach is simple

select name

click on button select to display

problem: the previous label is not getting overwritten


def display():
    value = combo1.get()
    
    row = df.loc[df["Project Name"] == value]
    projectname = row["Project Name"].values[0]
    srno = row["Sr No"].astype(str).values[0]
    client = row["Client"].values[0]

    label19 = ttkb.Label(Frame2, text="",bootstyle="info")
    label19.grid(row=0, column=1, padx=20, pady=10,columnspan=10)
    label19 = ttkb.Label(Frame2, text=srno,bootstyle="info")
    label19.grid(row=0, column=1, padx=20, pady=10,columnspan=10)
    label20 = ttkb.Label(Frame2, text="",bootstyle="info")
    label20.grid(row=1, column=1, padx=20, pady=10,columnspan=10)
    label20 = ttkb.Label(Frame2, text=client,bootstyle="info")
    label20.grid(row=1, column=1, padx=20, pady=10,columnspan=10)

Button1 = ttkb.Button(Frame, text="Select", bootstyle="success-link",command=display)
Button1.pack(side="left", padx=10)
    

tried several ways, seems to not working according to my code please note I m newbie

0

There are 0 best solutions below