I would like to display a dataframe as HTML table in tkinter window. I have seen options where I put the dataframe in treeview or use pandastable. However, what I am looking for is to display the table in the tkinter window exactly like it is displayed when I call the table() function. It is more of a visualization thing. Tree view is not good for visualization and pandastable is too complex for my purpose. Is there a way to display the dataframe in the tkinter window exactly like it is displayed in the terminal when I run the code outside of the tkinter window?? I would appreciate the help.
from tkinter import *
import pandas as pd
import numpy as np
from IPython.display import display, clear_output, HTML
def table():
df = pd.DataFrame(np.random.randint(0,100,size=(10, 4)), columns=list('ABCD'))
display(HTML(df.to_html()))
root = Tk()
termf = Frame(root, height=400, width=500)
termf.pack(fill=BOTH, expand=YES)
root.mainloop()