-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI.py
28 lines (19 loc) · 887 Bytes
/
GUI.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
import PySimpleGUI as sg
from PySimpleGUI.PySimpleGUI import R
from igraph.layout import Layout
from main import *
from fpGrowth import *
left_layout = [[sg.Text("Choose a dataset.csv"),sg.Input(),sg.FileBrowse(key='-IN-')],[sg.Button("Load")], [sg.Button('Exit')]]
right_layout = [[sg.Image(key='-IMAGE-')]]
layout = [[sg.Column(left_layout),sg.VSeparator(),sg.Column(right_layout)]]
window = sg.Window('FPTree Viewer', layout)
while True:
event, values = window.read()
if event == "Exit" or event == sg.WIN_CLOSED:
break
elif event == "Load":
fpTree, headerTable, itemSet = fpTreeFromFile(values['-IN-'], 0.5, 0.5)
g, visual_style, layout = fpTree.fpPlot(values['-IN-'])
ig.plot(g, "FPTree.png",layout=layout, **visual_style)
window['-IMAGE-'].update(source="FPTree.png")
window.close()