diff options
author | Raghuram Subramani <raghus2247@gmail.com> | 2024-06-08 17:01:35 +0530 |
---|---|---|
committer | Raghuram Subramani <raghus2247@gmail.com> | 2024-06-08 17:01:35 +0530 |
commit | fd9a31f983ef2cfd5c1a89be25fa9e262082737b (patch) | |
tree | 39371e157a3749ea824d211e315352963318122f /src/graph.py | |
parent | 22f6c7e5b3fd45480f2ef7827474fdb9d6c6f82c (diff) |
Matplotlib -> Tkinter
Diffstat (limited to 'src/graph.py')
-rw-r--r-- | src/graph.py | 17 |
1 files changed, 11 insertions, 6 deletions
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() |