-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodeForces.py
More file actions
83 lines (73 loc) · 2.83 KB
/
codeForces.py
File metadata and controls
83 lines (73 loc) · 2.83 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
__author__ = 'zihaozhu'
import tkinter
import sqlite3
import CodeForcesCategorizer
from tkinter import *
dbProb=[]
def getProblems(var):
conn=sqlite3.connect('codeForces.db')
cursor = conn.execute("SELECT PROBLEM, TITLE FROM CODEFORCES WHERE TYPE LIKE ? AND STATUS = ?",('%'+str(var.get())+'%',0))
row=cursor.fetchall()
conn.close()
return row
def select(var):
value = "value is %s" % var.get()
row=getProblems(var)
cs=myText.curselection()
myText.delete(0,END)
for problem in row:
myText.insert(END,problem[0]+" "+problem[1])
#print(value)
def textSelect(evt):
prob=evt.widget
index = int(prob.curselection()[0])
value = prob.get(index)
toplevel = Toplevel()
#complete task
problem=value.split()[0]
print(problem)
completed = Button(toplevel, text="Completed", width=10, command=lambda:CodeForcesCategorizer.update(problem))
completed.pack()
No = Button(toplevel,text="None", width=10, command=lambda:toplevel.destroy())
No.pack()
print("You selected item %s"%(value))
#do the following for responsive design
#problems=CodeForcesCategorizer.setUp()
problems=sorted(['None','2-sat', 'matrices', 'constructive algorithms', 'two pointers', 'sortings', 'implementation', 'games', 'graph matchings', 'combinatorics', 'string suffix structures', 'schedules', 'number theory', 'dp', 'bitmasks', 'flows', 'dsu', 'chinese remainder theorem', 'divide and conquer', 'ternary search', 'strings', 'graphs', 'dfs and similar', 'probabilities', 'shortest paths', 'expression parsing', 'brute force', 'meet-in-the-middle', 'binary search', 'greedy', 'hashing', 'geometry', 'trees', 'fft', 'data structures', 'math'])
window = Tk()
#problem list
var2=StringVar()
problemList = Label(window, text="Problems")
problemList.place(x=100,y=50)
#initial set up
setup = Button(window, text="Initial Set Up/Reset",command=lambda :CodeForcesCategorizer.setUp())
setup.place(x=200,y=340)
#text for the problems
text = Scrollbar(window)
myText = Listbox(window,yscrollcommand=text.set,width=30)
text.place(x=50,y=70)
myText.insert(END,"None")
myText.bind('<Double-Button-1>',textSelect)
myText.place(x=50,y=70)
text.config(command=myText.yview)
#following is the label for title
var=StringVar()
title = Label(window,text="CodeForces Categorizer",justify="center")
title.pack()
#label for problems
problemChoices = Label(window,textvariable=var)
var.set("Problem Types")
problemChoices.place(x=300,y=50)
var1 = StringVar(window)
#initialize value for drop down box
var1.set("None")
#drop down box for problem choices
dropDown = tkinter.OptionMenu(window,var1,*problems)
dropDown.place(x=300,y=70)
dropDown.configure(width=15)
#button to submit problem choice
submit = Button(window, text="Find", command=lambda: select(var1))
submit.place(x=420,y=70)
window.maxsize(500,500)
window.minsize(500,500)
window.mainloop()