0
def display():
root2=customtkinter.CTk()
root2.title('View Results')
root2.geometry('500x350')
new_frame= customtkinter.CTkFrame(root2)
print("FIFA World Cup Winners\n")
print(f'Country\t\tWins\tYears')
print("=======\t\t====\t=======")
for country in sorted(data_dict):
    print(f'{country}\t\t{len(data_dict[country])}\t', end="")
    print(*data_dict[country], sep = ", ")
root2.mainloop() 

I have tried this code and also tried treeview but no luck. Have to print this dictonary in table view in tkinter

1 Answers1

0
import tkinter 

root = tkinter.Tk()

#frame
frame1 = tkinter.Frame(master=root)
frame1.place(x=0)

#for display output
text_box = tkinter.Text(master=frame1
                       ,font=('arial',10 ,'bold'))
text_box.pack()

data_dict = {10:100 ,20:200 ,30:300 ,40:400}

for data in  data_dict:
    text_box.insert('end',str(data)+"\n")


root.mainloop()
Thisal
  • 64
  • 4