From fd9a31f983ef2cfd5c1a89be25fa9e262082737b Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Sat, 8 Jun 2024 17:01:35 +0530 Subject: Matplotlib -> Tkinter --- src/graph.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/graph.py') diff --git a/src/graph.py b/src/graph.py index 9aecde1..6c8ab53 100644 --- a/src/graph.py +++ b/src/graph.py @@ -1,4 +1,4 @@ -import io +import tkinter as tk from graphviz import Digraph import matplotlib.pyplot as plt @@ -49,8 +49,13 @@ class Graph: self.dot.edge(str(id(node1)), str(id(node2)) + node2._op) def show(self): - fp = io.BytesIO(self.dot.pipe(format='jpeg')) - with fp: - img = mpimg.imread(fp, format='jpeg') - plt.imshow(img) - plt.show() + root = tk.Tk() + root.title('float') + + data = self.dot.pipe(format='png') + img = tk.PhotoImage(data=data, format='png') + + panel = tk.Label(root, image=img) + panel.pack(); + + tk.mainloop() -- cgit v1.2.3