I am trying to create Label Dynamically , I am getting invalid Syntax. Can you please help me what i am missing or any alternative
crsr = cnxn.execute(query)
row_num=2
column_num=0
Variable_Number=1
for row in crsr.fetchall():
test='Column_Label'+str(Variable_Number)+' = tk.Label(frame,text="'+row[0]+'")'
#proper Indentation availabe in code test1='Column_Label'+str(Variable_Number)+'.grid(row='+str(row_num)+',column='+str(column_num)+')'
eval(test+';'+test1)
# eval(test1)
row_num+=1
column_num+=1
root.update_idletasks()
See Question&Answers more detail:os