-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualize.py
34 lines (29 loc) · 999 Bytes
/
visualize.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os, sys, importlib, time
from PIL import Image, ImageTk
import Tkinter
def visualize_image(file_image):
"""visualize the image with Tk window
args:
file_image (str)
"""
window = Tkinter.Tk()
window.wm_title(file_image)
image_to_show = Image.open(file_image)
image_tk = ImageTk.PhotoImage(image_to_show)
image_label = Tkinter.Label(window, image=image_tk)
image_label.pack(side = "bottom", fill = "both", expand = "yes")
window.mainloop()
def visualize_diff(file_before, file_after, file_diffs, file_ext, file_output_name = None):
"""visualize the file diff
args:
file_before (str)
file_diffs (list)
file_after (str)
file_ext (str)
file_output_name (str)
returns:
saved_file (list)
"""
file_visualizer = importlib.import_module("format." + file_ext + ".visualizer")
saved_file = file_visualizer.visualize(file_before, file_after, file_diffs)
return saved_file