I am building a small application using tkinter where it shows you the list of work done in the particular given interval ,the format is as below
co11 col2
Time done Activity name
Below is the code.since the two columns are far away when i hover on one of the two labels inside the for loop, i want both the labels to be highlight for easy identification of time done-activity name. i have implemented the labels in a grid layout as separate labels.
def on_click(e):
e.widget['bg']='#fafafa'
def on_leave(e):
e.widget['bg']='#dcdcdc'
if result1:
Label(second_frame, text=start_time[11:], width=115, font=('Tahoma', 15),
fg='black',bg='#aaaaaa').grid(row=x,column=0, columnspan=2)
x += 1
for j in result1:
temp = int(j[2]) * int(j[3])
# print(j[0][11:], j[1], j[2], j[3], temp)
sub_total += temp
total_pts += temp
e1=Label(second_frame, text=j[0][11:], font=('Tahoma', 12), bg='#dcdcdc', width=71)
e1.grid(row=x,column=0)
e2=Label(second_frame, text=str(j[1]), font=('Tahoma', 12), bg='#dcdcdc', width=71)
e2.grid(row=x,column=1)
e1.bind('<Enter>',on_click)
e1.bind('<Leave>',on_leave)
e2.bind('<Enter>', on_click)
e2.bind('<Leave>', on_leave)
x += 1