-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
48 lines (33 loc) · 1.41 KB
/
main.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import tkinter as tk
from tkinter import ttk
from tkinter import *
from qp import query_processor
def show():
tempList = query_processor(raw_query.get())
result_list = []
if len(tempList) >= 1:
for i in range(1,len(tempList)+1):
result_list.append([i, str(tempList[i-1]) + ".txt"])
result_list.append(["-","-"])
for i, (num, name) in enumerate(result_list, start=1):
listBox.insert("", "end", values=( num, name))
root = tk.Tk()
root.title('Boolean Retrieval')
windowWidth = root.winfo_reqwidth()
windowHeight = root.winfo_reqheight()
positionRight = int(root.winfo_screenwidth()/2 - windowWidth)
positionDown = int(root.winfo_screenheight()/2 - windowHeight)
root.geometry("+{}+{}".format(positionRight, positionDown))
raw_query = StringVar()
label = tk.Label(root, text="Enter query ").grid(row=0,column =0, columnspan=3)
entry = tk.Entry(root, text="",textvariable = raw_query).grid(row=1, column=0, columnspan=3)
button = tk.Button(root, text="Search",command=show).grid(row=2, column=0, columnspan=3)
# create Treeview with 2 columns
cols = ('S.No', 'Document Name')
listBox = ttk.Treeview(root, columns=cols, show='headings', height = 20)
# set column headings
for col in cols:
listBox.heading(col, text=col)
listBox.grid(row=3, column=0, columnspan=2)
closeButton = tk.Button(root, text="Close", width=15, command=exit).grid(row=4, columnspan=3)
root.mainloop()