from tkinter import *
import matplotlib
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
matplotlib.use('TkAgg')
def graph(container, text, width, height, position=(-0.15, 0.35), font_size=41):
figure = matplotlib.figure.Figure(figsize=(width, height), dpi=100)
equation = figure.add_subplot(111)
canvas = FigureCanvasTkAgg(figure, master=container)
canvas.get_tk_widget().pack(side="top", fill="both", expand=True)
canvas._tkcanvas.pack(fill="both", expand=True, side="top")
equation.get_xaxis().set_visible(False)
equation.get_yaxis().set_visible(False)
equation.spines["right"].set_visible(False)
equation.spines["left"].set_visible(False)
equation.spines["top"].set_visible(False)
equation.spines["bottom"].set_visible(False)
equation.clear()
equation.text(position[0], position[1], "$"+text+"$", fontsize=font_size)
canvas.draw()
root = Tk()
root.geometry("625x225")
root.title("Latex Viewer")
label = Label(root)
label.pack(pady=10, padx=10)
graph(label, r"|-2(sqrt[12]{frac{8192}{2}})| = -8x", 15, 2)
", """, "'", "")
root.mainloop()