From ae805e3c77f313292d1c064b0a16382a55ed799b Mon Sep 17 00:00:00 2001 From: Date: Tue, 16 Apr 2019 12:25:23 -0400 Subject: [PATCH 01/36] test --- test.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test.py diff --git a/test.py b/test.py new file mode 100644 index 0000000..fea6feb --- /dev/null +++ b/test.py @@ -0,0 +1,24 @@ +from tkinter import * + +root = Tk() +main_frame = Frame(root) +main_frame.pack() + +top_frame = Frame(main_frame) +top_frame.pack(side=TOP) + +bottom_frame = Frame(main_frame) +bottom_frame.pack(side=BOTTOM) + +button1 = Button(top_frame, text="Top 1") +button1.pack(side=LEFT) +button2 = Button(top_frame, text="Top 2") +button2.pack(side=RIGHT) + +button3 = Button(bottom_frame, text="Bottom 1") +button3.pack(side=LEFT) +button4 = Button(bottom_frame, text="Bottom 2") +button4.pack(side=RIGHT) + +root.mainloop() +print("Hello") \ No newline at end of file From 395f9ddb3a75e7eb4f27801510ab831b9bb2d46b Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 12:34:17 -0400 Subject: [PATCH 02/36] Removed args --- project.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/project.py b/project.py index 3459fe2..b358845 100644 --- a/project.py +++ b/project.py @@ -1,8 +1,6 @@ # Jonathan Michaels # 5/6/14 -import sys - class Statement: def __init__(self, first=''): if first != '': @@ -346,15 +344,9 @@ def solveTable(statements): print(str(statement + 1) + ': ' + str(statements[statement])) -if len(sys.argv) != 2: - # ask for input file if none is provided - if len(sys.argv) == 1: - sys.argv.append(input("Enter input file: ")) - else: - print('Invalid command line arguments.') - sys.exit() +fileName = input("Enter input file: ") -f = open(sys.argv[1]).readlines() +f = open(fileName).readlines() statements = parseInput(f) solveTable(statements) From 4f6da6258ca675fbbafeaab34de8aa810783fdae Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 12:48:11 -0400 Subject: [PATCH 03/36] Changed spacing --- project.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/project.py b/project.py index b358845..e6b1fea 100644 --- a/project.py +++ b/project.py @@ -1,6 +1,8 @@ # Jonathan Michaels # 5/6/14 +from tkinter import * + class Statement: def __init__(self, first=''): if first != '': @@ -341,16 +343,13 @@ def solveTable(statements): count += 1 print('\nStep ' + str(count) + ' - ' + toPrint) for statement in range(len(statements)): - print(str(statement + 1) + ': ' + str(statements[statement])) - - -fileName = input("Enter input file: ") - -f = open(fileName).readlines() -statements = parseInput(f) -solveTable(statements) - - - + print(str(statement + 1) + ': ' + str(statements[statement])) +if __name__ == "__main__": + fileName = input("Enter input file: ") + + f = open(fileName).readlines() + statements = parseInput(f) + solveTable(statements) + \ No newline at end of file From 534089b19c89e26dc928b477575bda528349e82c Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 13:10:37 -0400 Subject: [PATCH 04/36] Added buttons --- project.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/project.py b/project.py index e6b1fea..f717cd4 100644 --- a/project.py +++ b/project.py @@ -346,7 +346,54 @@ def solveTable(statements): print(str(statement + 1) + ': ' + str(statements[statement])) +class MyApp(object): + def __init__(self, parent): + self.parent = parent + self.main_frame = Frame(self.parent) ##parent of this frame + self.main_frame.pack() ##make this visible + + self.top_frame = Frame(self.main_frame) + self.top_frame.pack(side=TOP) + + self.bottom_frame = Frame(self.main_frame) + self.bottom_frame.pack(side=BOTTOM) + + self.canvas = Canvas(self.top_frame, height=600, width=600) + self.canvas.pack() + + self.button1 = Button(self.bottom_frame, text="Enter File Name", command=self.enterFileName) + self.button1.pack(side=LEFT) + self.button2 = Button(self.bottom_frame, text="Prev Step", command=self.prevStep) + self.button2.pack(side=LEFT) + self.button3=Button(self.bottom_frame, text="Next Step", command=self.nextStep) + self.button3.pack(side=LEFT) + + self.button4=Button(self.bottom_frame, text="Finish", command=self.finish) + self.button4.pack(side=LEFT) + + self.is_moving=True + self.wait_time=50 + + def enterFileName(self): + pass + + def prevStep(self): + pass + + def nextStep(self): + pass + + def finish(self): + pass + + + if __name__ == "__main__": + + root = Tk() + myapp=MyApp(root) + root.mainloop() + fileName = input("Enter input file: ") f = open(fileName).readlines() From 1c62905c6cdacef27fbd53aff88a0d80607d7cab Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 13:24:46 -0400 Subject: [PATCH 05/36] Added data structure to solve table --- project.py | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/project.py b/project.py index f717cd4..a21dc0e 100644 --- a/project.py +++ b/project.py @@ -296,6 +296,8 @@ def isComplete(statements): def solveTable(statements): + result = [] + global changedLiterals changedLiterals = dict() @@ -303,17 +305,17 @@ def solveTable(statements): statement.assignment = True statements[-1].assignment = False - print('Original Statements:') + result.append('Original Statements:\n') for statement in range(len(statements)): - print(str(statement + 1) + ': ' + str(statements[statement])) + result[0] += str(statement + 1) + ': ' + str(statements[statement]) + "\n" count = 0 while True: # look for contradiction for statement in range(len(statements)): if not statements[statement].isValid(): - print('\nContradiction found in Statement ' + str(statement + 1) + '! Therefore, this is valid.') - return + result.append('\nContradiction found in Statement ' + str(statement + 1) + '! Therefore, this is valid.\n') + return result # see if any literal's truth value needs to be propogated to all statements if len(changedLiterals) > 0: @@ -334,16 +336,16 @@ def solveTable(statements): # no assignment was forced. check if the statements are complete else: if isComplete(statements): - print('\nNo contradiction found! Therefore, this is invalid.') + result.append('\nNo contradiction found! Therefore, this is invalid.\n') else: - print('\nNo forced move') - return + result.append('\nNo forced move\n') + return result - input() + #input() count += 1 - print('\nStep ' + str(count) + ' - ' + toPrint) + result.append('\nStep ' + str(count) + ' - ' + toPrint + "\n") for statement in range(len(statements)): - print(str(statement + 1) + ': ' + str(statements[statement])) + result[-1] += str(statement + 1) + ': ' + str(statements[statement]) + "\n" class MyApp(object): @@ -375,7 +377,7 @@ def __init__(self, parent): self.wait_time=50 def enterFileName(self): - pass + pass def prevStep(self): pass @@ -390,13 +392,15 @@ def finish(self): if __name__ == "__main__": - root = Tk() - myapp=MyApp(root) - root.mainloop() - - fileName = input("Enter input file: ") + #root = Tk() + #myapp=MyApp(root) + #root.mainloop() + fileName = "inputs/3premises.txt" + f = open(fileName).readlines() statements = parseInput(f) - solveTable(statements) - \ No newline at end of file + r = solveTable(statements) + + for i in r: + print(i) \ No newline at end of file From 763460f03a4eb20ab06d32504f3ec0130f9d8443 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 13:38:11 -0400 Subject: [PATCH 06/36] Implemented next, prev, finish --- project.py | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/project.py b/project.py index a21dc0e..d5f4c38 100644 --- a/project.py +++ b/project.py @@ -375,32 +375,43 @@ def __init__(self, parent): self.is_moving=True self.wait_time=50 + + self.table = [] + self.current = 0 def enterFileName(self): - pass + fileName = "inputs/3premises.txt" + + f = open(fileName).readlines() + statements = parseInput(f) + self.table = solveTable(statements) def prevStep(self): - pass + self.current -= 2 + print(self.table[self.current]) + self.current += 1 def nextStep(self): - pass + print(self.table[self.current]) + self.current += 1 def finish(self): - pass + for i in range(self.current, len(self.table)): + print(self.table[i]) if __name__ == "__main__": - #root = Tk() - #myapp=MyApp(root) - #root.mainloop() + root = Tk() + myapp=MyApp(root) + root.mainloop() - fileName = "inputs/3premises.txt" + #fileName = "inputs/3premises.txt" - f = open(fileName).readlines() - statements = parseInput(f) - r = solveTable(statements) + #f = open(fileName).readlines() + #statements = parseInput(f) + #r = solveTable(statements) - for i in r: - print(i) \ No newline at end of file + #for i in r: + #print(i) \ No newline at end of file From 558397907db12e83719d663991138751c6b9edf3 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 13:55:50 -0400 Subject: [PATCH 07/36] Fixed spacing --- project.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/project.py b/project.py index d5f4c38..2b0e744 100644 --- a/project.py +++ b/project.py @@ -373,8 +373,6 @@ def __init__(self, parent): self.button4=Button(self.bottom_frame, text="Finish", command=self.finish) self.button4.pack(side=LEFT) - self.is_moving=True - self.wait_time=50 self.table = [] self.current = 0 From 6fc64155d6f74bbf16d16f65b0f355a95129581f Mon Sep 17 00:00:00 2001 From: Date: Tue, 16 Apr 2019 13:56:55 -0400 Subject: [PATCH 08/36] started writing code for the enter file name button --- project.py | 24 ++++++++++++++++++++++-- test.py | 30 ++++++++++++------------------ 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/project.py b/project.py index f717cd4..d29b4e3 100644 --- a/project.py +++ b/project.py @@ -351,7 +351,6 @@ def __init__(self, parent): self.parent = parent self.main_frame = Frame(self.parent) ##parent of this frame self.main_frame.pack() ##make this visible - self.top_frame = Frame(self.main_frame) self.top_frame.pack(side=TOP) @@ -371,11 +370,32 @@ def __init__(self, parent): self.button4=Button(self.bottom_frame, text="Finish", command=self.finish) self.button4.pack(side=LEFT) + self.is_moving=True self.wait_time=50 + + def enter_file(self,e1): + filename = e1.get() + print(filename) + def enterFileName(self): - pass + file_window = Tk() + + l1 = Label(file_window, text="File Name") + l1.pack( side = LEFT) + + e1 = Entry(file_window, bd =5) + e1.pack(side = RIGHT) + + file_frame = Frame(file_window) + file_frame.pack(side = BOTTOM) + + button5 = Button(file_frame, text="Enter", command=self.enter_file(e1)) + button5.pack(side = RIGHT) + + file_window.mainloop() + def prevStep(self): pass diff --git a/test.py b/test.py index fea6feb..492c085 100644 --- a/test.py +++ b/test.py @@ -1,24 +1,18 @@ from tkinter import * -root = Tk() -main_frame = Frame(root) -main_frame.pack() - -top_frame = Frame(main_frame) -top_frame.pack(side=TOP) +def enter_file(): + filename = e1.get() -bottom_frame = Frame(main_frame) -bottom_frame.pack(side=BOTTOM) +file_window = Tk() -button1 = Button(top_frame, text="Top 1") -button1.pack(side=LEFT) -button2 = Button(top_frame, text="Top 2") -button2.pack(side=RIGHT) +main_frame = Frame(file_window) +main_frame.pack() -button3 = Button(bottom_frame, text="Bottom 1") -button3.pack(side=LEFT) -button4 = Button(bottom_frame, text="Bottom 2") -button4.pack(side=RIGHT) +l1 = Label(file_window, text="File Name") +l1.pack( side = LEFT) +e1 = Entry(file_window, bd =5) +e1.pack(side = RIGHT) +button = Button(main_frame, text="Enter", command=enter_file) +button.pack() -root.mainloop() -print("Hello") \ No newline at end of file +file_window.mainloop() From 971079fe19c596791a1c73b5b56c2ece3ece8f40 Mon Sep 17 00:00:00 2001 From: Date: Tue, 16 Apr 2019 16:19:21 -0400 Subject: [PATCH 09/36] fixed enter button --- project.py | 30 +++++++++++++++++++----------- test.py | 1 + 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/project.py b/project.py index 6b37f2d..d3e3b0f 100644 --- a/project.py +++ b/project.py @@ -371,33 +371,41 @@ def __init__(self, parent): self.button4=Button(self.bottom_frame, text="Finish", command=self.finish) self.button4.pack(side=LEFT) - - - + self.e1 = "" self.table = [] self.current = 0 + #self.parent.mainloop() + - def enter_file(self,e1): - filename = e1.get() - print(filename) def enterFileName(self): - file_window = Tk() + file_window = Toplevel(self.parent) l1 = Label(file_window, text="File Name") l1.pack( side = LEFT) - e1 = Entry(file_window, bd =5) - e1.pack(side = RIGHT) + self.e1 = Entry(file_window, bd =5) + self.e1.pack(side = RIGHT) file_frame = Frame(file_window) file_frame.pack(side = BOTTOM) - button5 = Button(file_frame, text="Enter", command=self.enter_file(e1)) + button5 = Button(file_frame, text="Enter", command=self.enter_file) button5.pack(side = RIGHT) - file_window.mainloop() + #file_window.mainloop() + + + def enter_file(self): + fileName = self.e1.get() + try: + f = open(fileName).readlines() + except: + print("nah bruh") + + statements = parseInput(f) + self.table = solveTable(statements) def prevStep(self): diff --git a/test.py b/test.py index dbc2556..e73151c 100644 --- a/test.py +++ b/test.py @@ -1,6 +1,7 @@ from tkinter import * def enter_file(): + print("hello") filename = e1.get() file_window = Tk() From f0fc6ec508593704237bba25dc9f7efefd712a40 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 17:25:28 -0400 Subject: [PATCH 10/36] Added text box --- project.py | 50 +++++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/project.py b/project.py index d3e3b0f..93431e9 100644 --- a/project.py +++ b/project.py @@ -359,23 +359,26 @@ def __init__(self, parent): self.bottom_frame = Frame(self.main_frame) self.bottom_frame.pack(side=BOTTOM) - self.canvas = Canvas(self.top_frame, height=600, width=600) - self.canvas.pack() + self.scrollbar = Scrollbar(self.parent) + self.scrollbar.pack( side = RIGHT, fill = Y ) - self.button1 = Button(self.bottom_frame, text="Enter File Name", command=self.enterFileName) + self.text = Text(self.parent, yscrollcommand = self.scrollbar.set, state = DISABLED) + self.text.pack() + + self.scrollbar.config( command = self.text.yview ) + + self.button1 = Button(self.top_frame, text="Enter File Name", command=self.enterFileName) self.button1.pack(side=LEFT) - self.button2 = Button(self.bottom_frame, text="Prev Step", command=self.prevStep) + self.button2 = Button(self.top_frame, text="Prev Step", command=self.prevStep) self.button2.pack(side=LEFT) - self.button3=Button(self.bottom_frame, text="Next Step", command=self.nextStep) + self.button3=Button(self.top_frame, text="Next Step", command=self.nextStep) self.button3.pack(side=LEFT) - self.button4=Button(self.bottom_frame, text="Finish", command=self.finish) + self.button4=Button(self.top_frame, text="Finish", command=self.finish) self.button4.pack(side=LEFT) self.e1 = "" self.table = [] - self.current = 0 - #self.parent.mainloop() - + self.current = 0 @@ -393,8 +396,6 @@ def enterFileName(self): button5 = Button(file_frame, text="Enter", command=self.enter_file) button5.pack(side = RIGHT) - - #file_window.mainloop() def enter_file(self): @@ -410,30 +411,25 @@ def enter_file(self): def prevStep(self): self.current -= 2 - print(self.table[self.current]) + self.text.config(state = DISABLED) + self.text.insert(INSERT, self.table[self.current]) + self.text.config(state = NORMAL) self.current += 1 def nextStep(self): - print(self.table[self.current]) + self.text.config(state = DISABLED) + self.text.insert(INSERT, self.table[self.current]) + self.text.config(state = NORMAL) self.current += 1 def finish(self): + self.text.config(state = NORMAL) for i in range(self.current, len(self.table)): - print(self.table[i]) - - + self.text.insert(INSERT, self.table[i]) + self.text.config(state = DISABLED) + if __name__ == "__main__": - root = Tk() myapp=MyApp(root) - root.mainloop() - - #fileName = "inputs/3premises.txt" - - #f = open(fileName).readlines() - #statements = parseInput(f) - #r = solveTable(statements) - - #for i in r: - #print(i) \ No newline at end of file + root.mainloop() \ No newline at end of file From 5ba95c26b80ef25216342c3b0ccc513b0e67ea1e Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 17:27:19 -0400 Subject: [PATCH 11/36] Fixed buttons --- project.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/project.py b/project.py index 93431e9..6a3af49 100644 --- a/project.py +++ b/project.py @@ -411,15 +411,15 @@ def enter_file(self): def prevStep(self): self.current -= 2 - self.text.config(state = DISABLED) - self.text.insert(INSERT, self.table[self.current]) self.text.config(state = NORMAL) + self.text.insert(INSERT, self.table[self.current]) + self.text.config(state = DISABLED) self.current += 1 def nextStep(self): - self.text.config(state = DISABLED) - self.text.insert(INSERT, self.table[self.current]) self.text.config(state = NORMAL) + self.text.insert(INSERT, self.table[self.current]) + self.text.config(state = DISABLED) self.current += 1 def finish(self): From a9141b32bc847e2eb194a110214859981daff727 Mon Sep 17 00:00:00 2001 From: Date: Tue, 16 Apr 2019 17:29:26 -0400 Subject: [PATCH 12/36] fixed button errors to make sure only one window can be opened at a time --- project.py | 62 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/project.py b/project.py index d3e3b0f..37953d9 100644 --- a/project.py +++ b/project.py @@ -2,6 +2,7 @@ # 5/6/14 from tkinter import * +import time class Statement: def __init__(self, first=''): @@ -371,7 +372,12 @@ def __init__(self, parent): self.button4=Button(self.bottom_frame, text="Finish", command=self.finish) self.button4.pack(side=LEFT) + self.e1 = "" + self.file_window = "" + self.button5 = "" + self.fileName_error = "" + self.table = [] self.current = 0 #self.parent.mainloop() @@ -380,33 +386,65 @@ def __init__(self, parent): def enterFileName(self): - file_window = Toplevel(self.parent) + self.file_window = Toplevel(self.parent) + self.file_window.protocol("WM_DELETE_WINDOW", self.callback_file_window) + + self.button1.config(state = DISABLED) + self.button2.config(state = DISABLED) + self.button3.config(state = DISABLED) + self.button4.config(state = DISABLED) - l1 = Label(file_window, text="File Name") + l1 = Label(self.file_window, text="File Name") l1.pack( side = LEFT) - self.e1 = Entry(file_window, bd =5) - self.e1.pack(side = RIGHT) + self.e1 = Entry(self.file_window, bd =5) + self.e1.pack(side = LEFT) - file_frame = Frame(file_window) + file_frame = Frame(self.file_window) file_frame.pack(side = BOTTOM) - button5 = Button(file_frame, text="Enter", command=self.enter_file) - button5.pack(side = RIGHT) + self.button5 = Button(file_frame, text="Enter", command=self.enter_file) + self.button5.pack(side = RIGHT) - #file_window.mainloop() def enter_file(self): fileName = self.e1.get() try: + self.button5.config(state = NORMAL) f = open(fileName).readlines() + statements = parseInput(f) + self.table = solveTable(statements) + self.button1.config(state = NORMAL) + self.button2.config(state = NORMAL) + self.button3.config(state = NORMAL) + self.button4.config(state = NORMAL) + self.file_window.destroy() + except: - print("nah bruh") + self.fileName_error = Toplevel(self.parent) + self.fileName_error.protocol("WM_DELETE_WINDOW", self.callback_fileName_error) + l2 = Label(self.fileName_error, text="File does not exist. Close this window and enter a new file to continue") + l2.pack() + print(self.fileName_error.state()) + self.fileName_error.lift() + self.fileName_error.focus_force() - statements = parseInput(f) - self.table = solveTable(statements) - + self.button5.config(state = DISABLED) + + + + def callback_fileName_error(self): + self.button5.config(state = NORMAL) + self.fileName_error.destroy() + + def callback_file_window(self): + self.button1.config(state = NORMAL) + self.button2.config(state = NORMAL) + self.button3.config(state = NORMAL) + self.button4.config(state = NORMAL) + self.file_window.destroy() + def prevStep(self): self.current -= 2 From fd86773d1a9ca86dd7b69aa74b4fee50aeac592e Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 17:39:09 -0400 Subject: [PATCH 13/36] Edited current --- project.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/project.py b/project.py index e52c130..d7c84b1 100644 --- a/project.py +++ b/project.py @@ -384,7 +384,7 @@ def __init__(self, parent): self.fileName_error = "" self.table = [] - self.current = 0 + self.current = -1 #current represents the state just printed out @@ -452,21 +452,20 @@ def callback_file_window(self): def prevStep(self): - self.current -= 2 + self.current -= 1 self.text.config(state = NORMAL) self.text.insert(INSERT, self.table[self.current]) self.text.config(state = DISABLED) - self.current += 1 def nextStep(self): + self.current += 1 self.text.config(state = NORMAL) self.text.insert(INSERT, self.table[self.current]) self.text.config(state = DISABLED) - self.current += 1 def finish(self): self.text.config(state = NORMAL) - for i in range(self.current, len(self.table)): + for i in range(self.current + 1, len(self.table)): self.text.insert(INSERT, self.table[i]) self.text.config(state = DISABLED) From 1184cb8f5d7fa6ea4d2ed9240e357a2f3815662b Mon Sep 17 00:00:00 2001 From: Date: Tue, 16 Apr 2019 17:51:04 -0400 Subject: [PATCH 14/36] added more button saftey stuff --- project.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/project.py b/project.py index d7c84b1..07be48d 100644 --- a/project.py +++ b/project.py @@ -421,7 +421,7 @@ def enter_file(self): statements = parseInput(f) self.table = solveTable(statements) self.button1.config(state = NORMAL) - self.button2.config(state = NORMAL) + #self.button2.config(state = NORMAL) self.button3.config(state = NORMAL) self.button4.config(state = NORMAL) self.file_window.destroy() @@ -445,7 +445,7 @@ def callback_fileName_error(self): def callback_file_window(self): self.button1.config(state = NORMAL) - self.button2.config(state = NORMAL) + #self.button2.config(state = NORMAL) self.button3.config(state = NORMAL) self.button4.config(state = NORMAL) self.file_window.destroy() @@ -456,18 +456,23 @@ def prevStep(self): self.text.config(state = NORMAL) self.text.insert(INSERT, self.table[self.current]) self.text.config(state = DISABLED) + self.button3.config(state = NORMAL) + def nextStep(self): self.current += 1 self.text.config(state = NORMAL) self.text.insert(INSERT, self.table[self.current]) self.text.config(state = DISABLED) + self.button2.config(state = NORMAL) def finish(self): self.text.config(state = NORMAL) for i in range(self.current + 1, len(self.table)): self.text.insert(INSERT, self.table[i]) self.text.config(state = DISABLED) + self.button3.config(state = DISABLED) + self.button2.config(state = NORMAL) if __name__ == "__main__": From 4b923b4f616c0786aed2bfd5dd998d8e434bf8c0 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 17:55:59 -0400 Subject: [PATCH 15/36] Show all steps --- project.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/project.py b/project.py index 07be48d..a72b6b0 100644 --- a/project.py +++ b/project.py @@ -375,7 +375,7 @@ def __init__(self, parent): self.button3=Button(self.top_frame, text="Next Step", command=self.nextStep) self.button3.pack(side=LEFT) - self.button4=Button(self.top_frame, text="Finish", command=self.finish) + self.button4=Button(self.top_frame, text="Show All Steps", command=self.showAllSteps) self.button4.pack(side=LEFT) self.e1 = "" @@ -454,7 +454,8 @@ def callback_file_window(self): def prevStep(self): self.current -= 1 self.text.config(state = NORMAL) - self.text.insert(INSERT, self.table[self.current]) + self.text.delete(1.0,END) + self.text.insert(END, self.table[self.current]) self.text.config(state = DISABLED) self.button3.config(state = NORMAL) @@ -462,14 +463,16 @@ def prevStep(self): def nextStep(self): self.current += 1 self.text.config(state = NORMAL) - self.text.insert(INSERT, self.table[self.current]) + self.text.delete(1.0,END) + self.text.insert(END, self.table[self.current]) self.text.config(state = DISABLED) self.button2.config(state = NORMAL) - def finish(self): + def showAllSteps(self): self.text.config(state = NORMAL) - for i in range(self.current + 1, len(self.table)): - self.text.insert(INSERT, self.table[i]) + self.text.delete(1.0,END) + for i in range(len(self.table)): + self.text.insert(END, self.table[i]) self.text.config(state = DISABLED) self.button3.config(state = DISABLED) self.button2.config(state = NORMAL) From 990106c76adb31bed35a8afa54cf3819c535421e Mon Sep 17 00:00:00 2001 From: Date: Tue, 16 Apr 2019 18:22:42 -0400 Subject: [PATCH 16/36] worked on disabling buttons prev step and next step when needed --- project.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/project.py b/project.py index a72b6b0..a3909e7 100644 --- a/project.py +++ b/project.py @@ -408,7 +408,8 @@ def enterFileName(self): self.button5 = Button(file_frame, text="Enter", command=self.enter_file) self.button5.pack(side = RIGHT) - + self.file_window.focus_force() + self.e1.focus_set() @@ -458,6 +459,8 @@ def prevStep(self): self.text.insert(END, self.table[self.current]) self.text.config(state = DISABLED) self.button3.config(state = NORMAL) + if self.current == 0: + self.button2.config(state = DISABLED) def nextStep(self): @@ -467,6 +470,12 @@ def nextStep(self): self.text.insert(END, self.table[self.current]) self.text.config(state = DISABLED) self.button2.config(state = NORMAL) + if self.current == 0: + self.button2.config(state = DISABLED) + if self.current == len(self.table)-1: + self.button3.config(state = DISABLED) + else: + self.button3.config(state = NORMAL) def showAllSteps(self): self.text.config(state = NORMAL) From ed4695b7f69c4b8762423d67dc029a07bc554864 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 18:24:09 -0400 Subject: [PATCH 17/36] Changed buttons --- project.py | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/project.py b/project.py index a72b6b0..69fd15f 100644 --- a/project.py +++ b/project.py @@ -315,7 +315,7 @@ def solveTable(statements): # look for contradiction for statement in range(len(statements)): if not statements[statement].isValid(): - result.append('\nContradiction found in Statement ' + str(statement + 1) + '! Therefore, this is valid.\n') + result[-1] += '\nContradiction found in Statement ' + str(statement + 1) + '! Therefore, this is valid.\n' return result # see if any literal's truth value needs to be propogated to all statements @@ -337,14 +337,14 @@ def solveTable(statements): # no assignment was forced. check if the statements are complete else: if isComplete(statements): - result.append('\nNo contradiction found! Therefore, this is invalid.\n') + result[-1] += '\nNo contradiction found! Therefore, this is invalid.\n' else: - result.append('\nNo forced move\n') + result[-1] += '\nNo forced move\n' return result #input() count += 1 - result.append('\nStep ' + str(count) + ' - ' + toPrint + "\n") + result.append('Step ' + str(count) + ' - ' + toPrint + "\n") for statement in range(len(statements)): result[-1] += str(statement + 1) + ': ' + str(statements[statement]) + "\n" @@ -375,6 +375,9 @@ def __init__(self, parent): self.button3=Button(self.top_frame, text="Next Step", command=self.nextStep) self.button3.pack(side=LEFT) + self.button6 = Button(self.top_frame, text = "Last Step", command = self.lastStep) + self.button6.pack(side = LEFT) + self.button4=Button(self.top_frame, text="Show All Steps", command=self.showAllSteps) self.button4.pack(side=LEFT) @@ -395,7 +398,8 @@ def enterFileName(self): self.button1.config(state = DISABLED) self.button2.config(state = DISABLED) self.button3.config(state = DISABLED) - self.button4.config(state = DISABLED) + self.button4.config(state = DISABLED) + self.button6.config(state = DISABLED) l1 = Label(self.file_window, text="File Name") l1.pack( side = LEFT) @@ -423,8 +427,12 @@ def enter_file(self): self.button1.config(state = NORMAL) #self.button2.config(state = NORMAL) self.button3.config(state = NORMAL) - self.button4.config(state = NORMAL) + self.button4.config(state = NORMAL) + self.button6.config(state = NORMAL) + self.file_window.destroy() + + self.nextStep(); except: self.fileName_error = Toplevel(self.parent) @@ -448,15 +456,13 @@ def callback_file_window(self): #self.button2.config(state = NORMAL) self.button3.config(state = NORMAL) self.button4.config(state = NORMAL) + self.button6.config(state = NORMAL) self.file_window.destroy() def prevStep(self): - self.current -= 1 - self.text.config(state = NORMAL) - self.text.delete(1.0,END) - self.text.insert(END, self.table[self.current]) - self.text.config(state = DISABLED) + self.current -= 2 + self.nextStep(); self.button3.config(state = NORMAL) @@ -467,6 +473,11 @@ def nextStep(self): self.text.insert(END, self.table[self.current]) self.text.config(state = DISABLED) self.button2.config(state = NORMAL) + + def lastStep(self): + self.current = len(self.table) - 2 + self.nextStep(); + def showAllSteps(self): self.text.config(state = NORMAL) From be6e5b291af27e3b8141405b5799a30384524153 Mon Sep 17 00:00:00 2001 From: Date: Tue, 16 Apr 2019 18:49:10 -0400 Subject: [PATCH 18/36] pressing enter now does the same thing as clicking the enter button on filename window --- project.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/project.py b/project.py index 0090178..4b6af9b 100644 --- a/project.py +++ b/project.py @@ -410,15 +410,15 @@ def enterFileName(self): file_frame = Frame(self.file_window) file_frame.pack(side = BOTTOM) - self.button5 = Button(file_frame, text="Enter", command=self.enter_file) + self.file_window.bind('', self.enter_file) + self.button5 = Button(file_frame, text="Enter") + self.button5.bind('', self.enter_file) self.button5.pack(side = RIGHT) self.file_window.focus_force() self.e1.focus_set() - - - def enter_file(self): + def enter_file(self, self2): fileName = self.e1.get() try: self.button5.config(state = NORMAL) From 6fd3e1c5f69fd6bd365ee424eec92daa50542f92 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 18:50:25 -0400 Subject: [PATCH 19/36] Cleaned up --- project.py | 1 - 1 file changed, 1 deletion(-) diff --git a/project.py b/project.py index 0090178..9c68a63 100644 --- a/project.py +++ b/project.py @@ -440,7 +440,6 @@ def enter_file(self): self.fileName_error.protocol("WM_DELETE_WINDOW", self.callback_fileName_error) l2 = Label(self.fileName_error, text="File does not exist. Close this window and enter a new file to continue") l2.pack() - print(self.fileName_error.state()) self.fileName_error.lift() self.fileName_error.focus_force() From d272114757e00e2df3933944b1cd27563655867e Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Tue, 16 Apr 2019 18:57:38 -0400 Subject: [PATCH 20/36] Deleted time --- project.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/project.py b/project.py index 279d84d..d779f8e 100644 --- a/project.py +++ b/project.py @@ -2,7 +2,6 @@ # 5/6/14 from tkinter import * -import time class Statement: def __init__(self, first=''): @@ -349,7 +348,7 @@ def solveTable(statements): result[-1] += str(statement + 1) + ': ' + str(statements[statement]) + "\n" -class MyApp(object): +class GUI(object): def __init__(self, parent): self.parent = parent self.main_frame = Frame(self.parent) ##parent of this frame @@ -500,5 +499,5 @@ def showAllSteps(self): if __name__ == "__main__": root = Tk() - myapp=MyApp(root) + gui = GUI(root) root.mainloop() \ No newline at end of file From f005e79aa0dc286ac4d0f44e98c26391144fc900 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Wed, 17 Apr 2019 12:09:59 -0400 Subject: [PATCH 21/36] Added bat file --- STT-Solver.bat | 1 + 1 file changed, 1 insertion(+) create mode 100644 STT-Solver.bat diff --git a/STT-Solver.bat b/STT-Solver.bat new file mode 100644 index 0000000..c07852c --- /dev/null +++ b/STT-Solver.bat @@ -0,0 +1 @@ +python project.py \ No newline at end of file From 97336d30fee0b5088542ef99ff37a3d15b1419af Mon Sep 17 00:00:00 2001 From: Date: Wed, 17 Apr 2019 14:54:22 -0400 Subject: [PATCH 22/36] fixed bug with enter key not be disabled when it is supposed to --- project.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/project.py b/project.py index 279d84d..9e0a4c4 100644 --- a/project.py +++ b/project.py @@ -351,6 +351,8 @@ def solveTable(statements): class MyApp(object): def __init__(self, parent): + #problemo: if you are in the middle of stepping through a solution and you click enter new file and import the same file it won't start at the beginning + #same thing happens if they are 2 different files self.parent = parent self.main_frame = Frame(self.parent) ##parent of this frame self.main_frame.pack() ##make this visible @@ -410,8 +412,8 @@ def enterFileName(self): file_frame = Frame(self.file_window) file_frame.pack(side = BOTTOM) - self.file_window.bind('', self.enter_file) self.button5 = Button(file_frame, text="Enter") + self.file_window.bind('', self.enter_file) self.button5.bind('', self.enter_file) self.button5.pack(side = RIGHT) self.file_window.focus_force() @@ -421,7 +423,6 @@ def enterFileName(self): def enter_file(self, self2): fileName = self.e1.get() try: - self.button5.config(state = NORMAL) f = open(fileName).readlines() statements = parseInput(f) self.table = solveTable(statements) @@ -444,11 +445,15 @@ def enter_file(self, self2): self.fileName_error.focus_force() self.button5.config(state = DISABLED) + self.file_window.unbind('') + self.button5.unbind('') def callback_fileName_error(self): self.button5.config(state = NORMAL) + self.file_window.bind('', self.enter_file) + self.button5.bind('', self.enter_file) self.fileName_error.destroy() def callback_file_window(self): @@ -457,6 +462,7 @@ def callback_file_window(self): self.button3.config(state = NORMAL) self.button4.config(state = NORMAL) self.button6.config(state = NORMAL) + self.fileName_error.destroy() self.file_window.destroy() From d4445d40fe23f3d50c57c18f3e16097b17fd7fb8 Mon Sep 17 00:00:00 2001 From: Date: Wed, 17 Apr 2019 15:07:59 -0400 Subject: [PATCH 23/36] made the only button avaliable to click in the beginning the enter file name button and made it so when a new file is entered in the middle of going through a solution, it goes to the beginning of the solution for that --- project.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/project.py b/project.py index 314a26a..b21086d 100644 --- a/project.py +++ b/project.py @@ -375,12 +375,15 @@ def __init__(self, parent): self.button2.pack(side=LEFT) self.button3=Button(self.top_frame, text="Next Step", command=self.nextStep) self.button3.pack(side=LEFT) - + self.button4=Button(self.top_frame, text="Show All Steps", command=self.showAllSteps) + self.button4.pack(side=LEFT) self.button6 = Button(self.top_frame, text = "Last Step", command = self.lastStep) self.button6.pack(side = LEFT) - self.button4=Button(self.top_frame, text="Show All Steps", command=self.showAllSteps) - self.button4.pack(side=LEFT) + self.button2.config(state = DISABLED) + self.button3.config(state = DISABLED) + self.button4.config(state = DISABLED) + self.button6.config(state = DISABLED) self.e1 = "" self.file_window = "" @@ -430,6 +433,7 @@ def enter_file(self, self2): self.button3.config(state = NORMAL) self.button4.config(state = NORMAL) self.button6.config(state = NORMAL) + self.current = -1 self.file_window.destroy() @@ -445,12 +449,15 @@ def enter_file(self, self2): self.button5.config(state = DISABLED) self.file_window.unbind('') - self.button5.unbind('') + self.button5.unbind('') + + self.e1.config(state = DISABLED) def callback_fileName_error(self): self.button5.config(state = NORMAL) + self.e1.config(state = NORMAL) self.file_window.bind('', self.enter_file) self.button5.bind('', self.enter_file) self.fileName_error.destroy() From a62dbd86abe4bf32933b4a6762bafec4e86d1bd2 Mon Sep 17 00:00:00 2001 From: Date: Wed, 17 Apr 2019 15:23:34 -0400 Subject: [PATCH 24/36] put in titles for the windows --- project.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/project.py b/project.py index b21086d..a2fa4d9 100644 --- a/project.py +++ b/project.py @@ -350,9 +350,8 @@ def solveTable(statements): class GUI(object): def __init__(self, parent): - #problemo: if you are in the middle of stepping through a solution and you click enter new file and import the same file it won't start at the beginning - #same thing happens if they are 2 different files self.parent = parent + self.parent.title("STT-Solver") self.main_frame = Frame(self.parent) ##parent of this frame self.main_frame.pack() ##make this visible self.top_frame = Frame(self.main_frame) @@ -389,6 +388,7 @@ def __init__(self, parent): self.file_window = "" self.button5 = "" self.fileName_error = "" + self.fileName_entered = False self.table = [] self.current = -1 #current represents the state just printed out @@ -397,6 +397,7 @@ def __init__(self, parent): def enterFileName(self): self.file_window = Toplevel(self.parent) + self.file_window.title("Enter file name") self.file_window.protocol("WM_DELETE_WINDOW", self.callback_file_window) self.button1.config(state = DISABLED) @@ -434,6 +435,7 @@ def enter_file(self, self2): self.button4.config(state = NORMAL) self.button6.config(state = NORMAL) self.current = -1 + self.fileName_entered = True self.file_window.destroy() @@ -441,6 +443,7 @@ def enter_file(self, self2): except: self.fileName_error = Toplevel(self.parent) + self.fileName_error.title("File not found") self.fileName_error.protocol("WM_DELETE_WINDOW", self.callback_fileName_error) l2 = Label(self.fileName_error, text="File does not exist. Close this window and enter a new file to continue") l2.pack() @@ -464,12 +467,15 @@ def callback_fileName_error(self): def callback_file_window(self): self.button1.config(state = NORMAL) - #self.button2.config(state = NORMAL) - self.button3.config(state = NORMAL) - self.button4.config(state = NORMAL) - self.button6.config(state = NORMAL) - self.fileName_error.destroy() - self.file_window.destroy() + if self.fileName_entered == True: + self.button3.config(state = NORMAL) + self.button4.config(state = NORMAL) + self.button6.config(state = NORMAL) + try: + self.fileName_error.destroy() + self.file_window.destroy() + except: + self.file_window.destroy() def prevStep(self): From 8f421fcc9c9855f294d72d6b02ae0a37a70fd343 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Thu, 25 Apr 2019 17:44:44 -0400 Subject: [PATCH 25/36] started new button --- project.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/project.py b/project.py index a2fa4d9..17ed580 100644 --- a/project.py +++ b/project.py @@ -368,7 +368,9 @@ def __init__(self, parent): self.scrollbar.config( command = self.text.yview ) - self.button1 = Button(self.top_frame, text="Enter File Name", command=self.enterFileName) + self.button7 = Button(self.top_frame, text="New", command=self.newFile) + self.button7.pack(side=LEFT) + self.button1 = Button(self.top_frame, text="Open", command=self.enterFileName) self.button1.pack(side=LEFT) self.button2 = Button(self.top_frame, text="Prev Step", command=self.prevStep) self.button2.pack(side=LEFT) @@ -393,6 +395,22 @@ def __init__(self, parent): self.table = [] self.current = -1 #current represents the state just printed out + #broken + def newFile(self): + self.file_window2 = Toplevel(self.parent) + self.file_window2.title("New") + self.file_window2.protocol("WM_DELETE_WINDOW", self.callback_file_window) + + self.button1.config(state = DISABLED) + self.button2.config(state = DISABLED) + self.button3.config(state = DISABLED) + self.button4.config(state = DISABLED) + self.button6.config(state = DISABLED) + self.button7.config(state = DISABLED) + + + self.text2 = Text(self.file_window2) + self.text2.pack() def enterFileName(self): @@ -405,6 +423,7 @@ def enterFileName(self): self.button3.config(state = DISABLED) self.button4.config(state = DISABLED) self.button6.config(state = DISABLED) + self.button7.config(state = DISABLED) l1 = Label(self.file_window, text="File Name") l1.pack( side = LEFT) @@ -425,6 +444,7 @@ def enterFileName(self): def enter_file(self, self2): fileName = self.e1.get() + self.button7.config(state = NORMAL) try: f = open(fileName).readlines() statements = parseInput(f) @@ -434,6 +454,7 @@ def enter_file(self, self2): self.button3.config(state = NORMAL) self.button4.config(state = NORMAL) self.button6.config(state = NORMAL) + self.current = -1 self.fileName_entered = True @@ -467,10 +488,11 @@ def callback_fileName_error(self): def callback_file_window(self): self.button1.config(state = NORMAL) + self.button7.config(state = NORMAL) if self.fileName_entered == True: self.button3.config(state = NORMAL) self.button4.config(state = NORMAL) - self.button6.config(state = NORMAL) + self.button6.config(state = NORMAL) try: self.fileName_error.destroy() self.file_window.destroy() From d51cf984bd4312a5427f10827579401c17150aea Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Thu, 25 Apr 2019 18:01:49 -0400 Subject: [PATCH 26/36] added documentation --- README.md | 7 ++++--- Writeup 2019.docx | Bin 0 -> 11971 bytes ~$iteup 2019.docx | Bin 0 -> 162 bytes 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 Writeup 2019.docx create mode 100644 ~$iteup 2019.docx diff --git a/README.md b/README.md index 607ed74..f220217 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,13 @@ ## Authors 2014: Johnathan Michaels +2019: +Salil Chandra +Escher Campanella ## About To Run: -- Command Line: python3 project.py inputfile.txt -- IDLE: Run the program. Upon running, you will be prompted to enter the input file. -- Hit enter to get the next step +Double click on STT-Solver.bat. Click open and enter the input file. Click enter to start solving problem. Format of input file: - n lines diff --git a/Writeup 2019.docx b/Writeup 2019.docx new file mode 100644 index 0000000000000000000000000000000000000000..39eba34298e440e882fc05599079aedc26a3b455 GIT binary patch literal 11971 zcmeHt1zQ};w)Wue?jC{#cMFoi-5mmi0E4?H!4lk^;O;I#0t9!L!8JGp_iwV#*>`7W zpYQ&Gd-{30=c(#`SJzZ8srA-UmV<%C1;7Ik0RR9MU?q0~qzeTAP{IKKH~>UwJqbHo zXLDO;BXtjZb0>or?lvIGY*^^$nE+_W^Zz~m56?ht+@NhI8|JI4_*;zV294L>vx^y_ zLq!r;RCf^wy`VK8VtQL1+i;*&G@zo9LDY1dSIeB5J^tehDIg@QIybs~0^x-Bv4)ns zO!KpwEPiH0&(`ADmc{yc-hsGUT8ZR&px9{Yx?+aakd@MM(){tXuK^K^@sXOep5dJ2 z0r&Wvt5>bdFp0}__6$mO2qfr+nb;_?)wA3_w$jvuX7f&y+7|Kh0mikspZ2_Wr!wNa z6P2SJ!TwHUClSPi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8Rb% zhf(U?pxd~@c*DhNL`Jrdy1mjO!qEOSOq8+ksS}Ct$Ti$)xLkEKfhf5L+!7!+}{QKy*BX|EFc#0 z%3mrKe+T}(XzN#C4J0f0-%7ZCm-Krf&tI~3AtlZKDC_wh{`{Oj-d-^skc@Y_WH#{Wj`{Vw6}B-USe z0Duj$YxFy%^*j3S%)+ned9q*7fAS2!!++2B{u1zk^3U1(pX^Ur4i2IoKkHyo038q} K;C~Dh&Js2 literal 0 HcmV?d00001 diff --git a/~$iteup 2019.docx b/~$iteup 2019.docx new file mode 100644 index 0000000000000000000000000000000000000000..3b5e9f8ba4e2befaa08b20c56ab02a511f1cb1b0 GIT binary patch literal 162 zcmd-H&&*57FE3UIElw?BAQtd2gfnC^Ow<4F;niSJX6RsGXt2NWOdPDBpii7(0~E6ZMF1S_843UZ literal 0 HcmV?d00001 From 2b26d33122ad8fdf9f73b146cff52f42acc69d0f Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Thu, 25 Apr 2019 18:47:03 -0400 Subject: [PATCH 27/36] Updated open interface --- inputs/wrongformat.txt | 1 + project.py | 56 ++++++++++++++++++++++++++++-------------- 2 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 inputs/wrongformat.txt diff --git a/inputs/wrongformat.txt b/inputs/wrongformat.txt new file mode 100644 index 0000000..3e5cb6b --- /dev/null +++ b/inputs/wrongformat.txt @@ -0,0 +1 @@ +not valid format diff --git a/project.py b/project.py index 17ed580..5703051 100644 --- a/project.py +++ b/project.py @@ -2,6 +2,8 @@ # 5/6/14 from tkinter import * +from tkinter import filedialog +import os class Statement: def __init__(self, first=''): @@ -240,8 +242,9 @@ def getStatement(line, i): s.second.operation = line[i] s.second.first = Statement(line[i+1]) else: - print('Invalid input file.') - sys.exit() + #print('Invalid input file.') + #sys.exit() + raise Exception("Invalid input file.") i += 1 elif line[i] in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ': if s.operation == '' and s.first == '': @@ -249,11 +252,13 @@ def getStatement(line, i): elif s.second == '': s.second = Statement(line[i]) else: - print('Invalid input file.') - sys.exit() + #print('Invalid input file.') + #sys.exit() + raise Exception("Invalid input file.") else: - print('Invalid input file.') - sys.exit() + #print('Invalid input file.') + #sys.exit() + raise Exception("Invalid input file.") i += 1 if s.second == '': @@ -352,8 +357,8 @@ class GUI(object): def __init__(self, parent): self.parent = parent self.parent.title("STT-Solver") - self.main_frame = Frame(self.parent) ##parent of this frame - self.main_frame.pack() ##make this visible + self.main_frame = Frame(self.parent) + self.main_frame.pack() self.top_frame = Frame(self.main_frame) self.top_frame.pack(side=TOP) @@ -412,8 +417,13 @@ def newFile(self): self.text2 = Text(self.file_window2) self.text2.pack() - def enterFileName(self): + start = os.getcwd() + "\\inputs" + self.parent.filename = filedialog.askopenfilename(initialdir = start,title = "Select file",filetypes = (("txt files","*.txt"),("All files","*.*"))) + self.enter_file(None) + + + def enterFileNameAlt(self): self.file_window = Toplevel(self.parent) self.file_window.title("Enter file name") self.file_window.protocol("WM_DELETE_WINDOW", self.callback_file_window) @@ -443,25 +453,35 @@ def enterFileName(self): def enter_file(self, self2): - fileName = self.e1.get() - self.button7.config(state = NORMAL) try: + #fileName = self.e1.get() + fileName = self.parent.filename + self.button7.config(state = NORMAL) + #try: f = open(fileName).readlines() - statements = parseInput(f) + try: + statements = parseInput(f) + except Exception as e: + self.text.config(state = NORMAL) + self.text.delete(1.0,END) + self.text.insert(END, str(e)) + self.text.config(state = DISABLED) self.table = solveTable(statements) self.button1.config(state = NORMAL) #self.button2.config(state = NORMAL) self.button3.config(state = NORMAL) self.button4.config(state = NORMAL) self.button6.config(state = NORMAL) - + self.current = -1 - self.fileName_entered = True + #self.fileName_entered = True - self.file_window.destroy() + #self.file_window.destroy() - self.nextStep(); - + self.nextStep() + except: + pass + """ except: self.fileName_error = Toplevel(self.parent) self.fileName_error.title("File not found") @@ -476,7 +496,7 @@ def enter_file(self, self2): self.button5.unbind('') self.e1.config(state = DISABLED) - + """ def callback_fileName_error(self): From 85f54b5db88ba54e30d44f7e89c60df093f8b96c Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Thu, 25 Apr 2019 18:54:15 -0400 Subject: [PATCH 28/36] Button disabling --- project.py | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/project.py b/project.py index 5703051..9673ecc 100644 --- a/project.py +++ b/project.py @@ -461,24 +461,30 @@ def enter_file(self, self2): f = open(fileName).readlines() try: statements = parseInput(f) + self.table = solveTable(statements) + self.button1.config(state = NORMAL) + #self.button2.config(state = NORMAL) + self.button3.config(state = NORMAL) + self.button4.config(state = NORMAL) + self.button6.config(state = NORMAL) + + self.current = -1 + #self.fileName_entered = True + + #self.file_window.destroy() + + self.nextStep() except Exception as e: self.text.config(state = NORMAL) self.text.delete(1.0,END) self.text.insert(END, str(e)) - self.text.config(state = DISABLED) - self.table = solveTable(statements) - self.button1.config(state = NORMAL) - #self.button2.config(state = NORMAL) - self.button3.config(state = NORMAL) - self.button4.config(state = NORMAL) - self.button6.config(state = NORMAL) - - self.current = -1 - #self.fileName_entered = True - - #self.file_window.destroy() - - self.nextStep() + self.text.config(state = DISABLED) + + self.button2.config(state = DISABLED) + self.button3.config(state = DISABLED) + self.button4.config(state = DISABLED) + self.button6.config(state = DISABLED) + except: pass """ From 67e9aeeb8f394fc1c766dda496440d07eb4a2675 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Thu, 25 Apr 2019 18:59:06 -0400 Subject: [PATCH 29/36] Polished code --- project.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project.py b/project.py index 9673ecc..55581a0 100644 --- a/project.py +++ b/project.py @@ -483,9 +483,9 @@ def enter_file(self, self2): self.button2.config(state = DISABLED) self.button3.config(state = DISABLED) self.button4.config(state = DISABLED) - self.button6.config(state = DISABLED) - - except: + self.button6.config(state = DISABLED) + + except: #cancel pass """ except: From 478b1586ad1fd9ab134bbdf82665b009d2f6cb44 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Thu, 25 Apr 2019 22:01:56 -0400 Subject: [PATCH 30/36] Changed thing --- project.py | 6 +++--- ~$iteup 2019.docx | Bin 162 -> 0 bytes 2 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 ~$iteup 2019.docx diff --git a/project.py b/project.py index 55581a0..5796c80 100644 --- a/project.py +++ b/project.py @@ -402,9 +402,9 @@ def __init__(self, parent): #broken def newFile(self): - self.file_window2 = Toplevel(self.parent) - self.file_window2.title("New") - self.file_window2.protocol("WM_DELETE_WINDOW", self.callback_file_window) + self.file_window = Toplevel(self.parent) + self.file_window.title("New") + self.file_window.protocol("WM_DELETE_WINDOW", self.callback_file_window) self.button1.config(state = DISABLED) self.button2.config(state = DISABLED) diff --git a/~$iteup 2019.docx b/~$iteup 2019.docx deleted file mode 100644 index 3b5e9f8ba4e2befaa08b20c56ab02a511f1cb1b0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 162 zcmd-H&&*57FE3UIElw?BAQtd2gfnC^Ow<4F;niSJX6RsGXt2NWOdPDBpii7(0~E6ZMF1S_843UZ From 803bb45e5140cf285c3b8f6a631793af344a93a3 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Thu, 25 Apr 2019 22:35:21 -0400 Subject: [PATCH 31/36] implemented new --- project.py | 91 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 54 insertions(+), 37 deletions(-) diff --git a/project.py b/project.py index 5796c80..803dfc7 100644 --- a/project.py +++ b/project.py @@ -396,6 +396,7 @@ def __init__(self, parent): self.button5 = "" self.fileName_error = "" self.fileName_entered = False + self.text2 = "" self.table = [] self.current = -1 #current represents the state just printed out @@ -414,13 +415,37 @@ def newFile(self): self.button7.config(state = DISABLED) - self.text2 = Text(self.file_window2) + self.text2 = Text(self.file_window) self.text2.pack() + #original ^^ + file_frame = Frame(self.file_window) + file_frame.pack(side = BOTTOM) + self.button5 = Button(file_frame, text="Enter") + self.file_window.bind('', self.inputHelper) + self.button5.bind('', self.inputHelper) + self.button5.pack(side = RIGHT) + self.file_window.focus_force() + + def inputHelper(self, self2): + inputted = self.text2.get("1.0",END) + inputted = inputted.strip().split("\n") + for i in range(len(inputted)): + inputted[i] += "\n" + + self.fileName_entered = True + self.file_window.destroy() + self.enter_file(inputted) + + def enterFileName(self): start = os.getcwd() + "\\inputs" self.parent.filename = filedialog.askopenfilename(initialdir = start,title = "Select file",filetypes = (("txt files","*.txt"),("All files","*.*"))) - self.enter_file(None) + try: + f = open(self.parent.filename).readlines() + self.enter_file(f) + except: + pass def enterFileNameAlt(self): @@ -452,41 +477,33 @@ def enterFileNameAlt(self): self.e1.focus_set() - def enter_file(self, self2): + def enter_file(self, f): + self.button7.config(state = NORMAL) try: - #fileName = self.e1.get() - fileName = self.parent.filename - self.button7.config(state = NORMAL) - #try: - f = open(fileName).readlines() - try: - statements = parseInput(f) - self.table = solveTable(statements) - self.button1.config(state = NORMAL) - #self.button2.config(state = NORMAL) - self.button3.config(state = NORMAL) - self.button4.config(state = NORMAL) - self.button6.config(state = NORMAL) - - self.current = -1 - #self.fileName_entered = True - - #self.file_window.destroy() - - self.nextStep() - except Exception as e: - self.text.config(state = NORMAL) - self.text.delete(1.0,END) - self.text.insert(END, str(e)) - self.text.config(state = DISABLED) - - self.button2.config(state = DISABLED) - self.button3.config(state = DISABLED) - self.button4.config(state = DISABLED) - self.button6.config(state = DISABLED) - - except: #cancel - pass + statements = parseInput(f) + self.table = solveTable(statements) + self.button1.config(state = NORMAL) + #self.button2.config(state = NORMAL) + self.button3.config(state = NORMAL) + self.button4.config(state = NORMAL) + self.button6.config(state = NORMAL) + + self.current = -1 + #self.fileName_entered = True + + #self.file_window.destroy() + + self.nextStep() + except Exception as e: + self.text.config(state = NORMAL) + self.text.delete(1.0,END) + self.text.insert(END, str(e)) + self.text.config(state = DISABLED) + + self.button2.config(state = DISABLED) + self.button3.config(state = DISABLED) + self.button4.config(state = DISABLED) + self.button6.config(state = DISABLED) """ except: self.fileName_error = Toplevel(self.parent) @@ -508,7 +525,7 @@ def enter_file(self, self2): def callback_fileName_error(self): self.button5.config(state = NORMAL) self.e1.config(state = NORMAL) - self.file_window.bind('', self.enter_file) + self.file_window.bind('', self.enter_file) self.button5.bind('', self.enter_file) self.fileName_error.destroy() From 29665554293b29931f03ac7690613848ea5a89b6 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Thu, 25 Apr 2019 22:36:34 -0400 Subject: [PATCH 32/36] Focus set --- project.py | 1 + 1 file changed, 1 insertion(+) diff --git a/project.py b/project.py index 803dfc7..91f31c1 100644 --- a/project.py +++ b/project.py @@ -426,6 +426,7 @@ def newFile(self): self.button5.bind('', self.inputHelper) self.button5.pack(side = RIGHT) self.file_window.focus_force() + self.text2.focus_set() def inputHelper(self, self2): inputted = self.text2.get("1.0",END) From 33c89a62ba0702255d614275c79c403774105ec7 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Thu, 25 Apr 2019 22:52:13 -0400 Subject: [PATCH 33/36] fixed new --- project.py | 54 +++++++++++++++++++----------------------------------- 1 file changed, 19 insertions(+), 35 deletions(-) diff --git a/project.py b/project.py index 91f31c1..75e5840 100644 --- a/project.py +++ b/project.py @@ -244,7 +244,7 @@ def getStatement(line, i): else: #print('Invalid input file.') #sys.exit() - raise Exception("Invalid input file.") + raise Exception("Invalid input.") i += 1 elif line[i] in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ': if s.operation == '' and s.first == '': @@ -254,11 +254,11 @@ def getStatement(line, i): else: #print('Invalid input file.') #sys.exit() - raise Exception("Invalid input file.") + raise Exception("Invalid input.") else: #print('Invalid input file.') #sys.exit() - raise Exception("Invalid input file.") + raise Exception("Invalid input.") i += 1 if s.second == '': @@ -373,7 +373,7 @@ def __init__(self, parent): self.scrollbar.config( command = self.text.yview ) - self.button7 = Button(self.top_frame, text="New", command=self.newFile) + self.button7 = Button(self.top_frame, text="New", command=self.createInput) self.button7.pack(side=LEFT) self.button1 = Button(self.top_frame, text="Open", command=self.enterFileName) self.button1.pack(side=LEFT) @@ -391,7 +391,7 @@ def __init__(self, parent): self.button4.config(state = DISABLED) self.button6.config(state = DISABLED) - self.e1 = "" + #self.e1 = "" self.file_window = "" self.button5 = "" self.fileName_error = "" @@ -401,8 +401,8 @@ def __init__(self, parent): self.table = [] self.current = -1 #current represents the state just printed out - #broken - def newFile(self): + #click New + def createInput(self): self.file_window = Toplevel(self.parent) self.file_window.title("New") self.file_window.protocol("WM_DELETE_WINDOW", self.callback_file_window) @@ -418,7 +418,6 @@ def newFile(self): self.text2 = Text(self.file_window) self.text2.pack() - #original ^^ file_frame = Frame(self.file_window) file_frame.pack(side = BOTTOM) self.button5 = Button(file_frame, text="Enter") @@ -427,18 +426,18 @@ def newFile(self): self.button5.pack(side = RIGHT) self.file_window.focus_force() self.text2.focus_set() - + + #click enter in createInput, will call enter_file def inputHelper(self, self2): inputted = self.text2.get("1.0",END) inputted = inputted.strip().split("\n") for i in range(len(inputted)): inputted[i] += "\n" - self.fileName_entered = True self.file_window.destroy() self.enter_file(inputted) - + #click open (file browser) def enterFileName(self): start = os.getcwd() + "\\inputs" self.parent.filename = filedialog.askopenfilename(initialdir = start,title = "Select file",filetypes = (("txt files","*.txt"),("All files","*.*"))) @@ -448,7 +447,7 @@ def enterFileName(self): except: pass - + """ def enterFileNameAlt(self): self.file_window = Toplevel(self.parent) self.file_window.title("Enter file name") @@ -476,8 +475,9 @@ def enterFileNameAlt(self): self.button5.pack(side = RIGHT) self.file_window.focus_force() self.e1.focus_set() + """ - + #parse inputs and create table def enter_file(self, f): self.button7.config(state = NORMAL) try: @@ -490,9 +490,7 @@ def enter_file(self, f): self.button6.config(state = NORMAL) self.current = -1 - #self.fileName_entered = True - - #self.file_window.destroy() + self.fileName_entered = True self.nextStep() except Exception as e: @@ -505,31 +503,17 @@ def enter_file(self, f): self.button3.config(state = DISABLED) self.button4.config(state = DISABLED) self.button6.config(state = DISABLED) - """ - except: - self.fileName_error = Toplevel(self.parent) - self.fileName_error.title("File not found") - self.fileName_error.protocol("WM_DELETE_WINDOW", self.callback_fileName_error) - l2 = Label(self.fileName_error, text="File does not exist. Close this window and enter a new file to continue") - l2.pack() - self.fileName_error.lift() - self.fileName_error.focus_force() - - self.button5.config(state = DISABLED) - self.file_window.unbind('') - self.button5.unbind('') - - self.e1.config(state = DISABLED) - """ - + """ def callback_fileName_error(self): self.button5.config(state = NORMAL) self.e1.config(state = NORMAL) - self.file_window.bind('', self.enter_file) + self.file_window.bind('', self.enter_file) self.button5.bind('', self.enter_file) self.fileName_error.destroy() - + """ + + #click x on window def callback_file_window(self): self.button1.config(state = NORMAL) self.button7.config(state = NORMAL) From df1bdfd389c9149635f1e7b111259e8248b8ba6c Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Thu, 25 Apr 2019 22:59:19 -0400 Subject: [PATCH 34/36] finish --- README.md | 2 +- Writeup 2019.docx | Bin 11971 -> 12133 bytes project.py | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f220217..f353018 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Escher Campanella ## About To Run: -Double click on STT-Solver.bat. Click open and enter the input file. Click enter to start solving problem. +Double click on STT-Solver.bat. Click new and enter in statements (click enter on the keyboard twice when finished or press enter button). Can also click open and enter the input file. Click enter to start solving problem. Format of input file: - n lines diff --git a/Writeup 2019.docx b/Writeup 2019.docx index 39eba34298e440e882fc05599079aedc26a3b455..fb280670cb7c56010c8810d7fef47c725f332b6a 100644 GIT binary patch delta 3039 zcmV<53n28vUFBY|_XrBPj?z~Q1pokJ50e228Gp@k+cprscc$;K!&5S2i=rgUjwW)( zv1CtX($*6x=MF?dA|epr0HA2~)Ys_i^+~!5P=B$j*m2W?ErP&)_;&Z(1^D*eeIa4R zjTKrAqomc2fU8tzLM?{T=jqMqMFiF{l`*LmA4Y3#qj#4-|Ma#VWIC-1t{fnQvV*!z zhksG-Tseqio94V=wpEDKXshS0mFgna^SMZQTx*lXop#dpPo>c*w-)!iW@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++++----- test.py | 21 --------------------- 3 files changed, 12 insertions(+), 26 deletions(-) delete mode 100644 test.py diff --git a/Writeup 2019.docx b/Writeup 2019.docx index fb280670cb7c56010c8810d7fef47c725f332b6a..0c5f3d7d67114adcddcacf12a9988b25ba4e19bc 100644 GIT binary patch delta 3432 zcmV-u4VUueUf5r-_XrAmdF0G71pok%5R(B37=Kt>Z`(E$ejl*^aG<9YNG!>>Bu4Ba z^(6?hJ9o-=AD>eWTdFjZV(5jf zzym5G88fjSdS4f_s~ZorAtEMR3Oe+5RC^yszy5Mp3}PAODHR3~Lg+z}MMEz!CL8#^ zj(-xG65UE!q@&e?NP)r@ zu+EcM2gOW=1QA?Rb|@ErP8C{tcCZ$=D*Ga_Ok_7dk%c&W2yk`g8kihsy8N6rmGfzl{rGK18 zgU7XyiYz%Y!q@|b4_pMmR*5&lZn~85&VFW446qx=Uxr=~bSM4m`-xXSn$Q)=xp}?w zWFJl1*I}mw%bt||&>4x41|H(fI-`3NSP8rMl3Ok$H`4P*cm7_){WGIE;f%vL!N#x1 zB}}dP3dRIGo1mN%D`A|RDy3ghpMT9dvx!sp|57go-y+=D5r7Ei)s}iAXcC`(>UTTSQhYRa`hTYd7zr+-_6B08 z9Y-22D2WneM?uq!C}-PphsFvNu%7(Tf+y6fD^Xb*xuLtIBq|0|V8wz|?rC{snHyt| zNmwz#bOKCd_z3;g#JST6+JBSlMw6|I1NCzqa2l-D=)hzDR}TCG2a~l4;~%3%=%E$k zv;|XVv!!O&AV^B#q8wk)GSB7%V9^6*##Vg9o3!@2*W<~!(rR^<{#+@UIt4cWUG^_2#7t+L>}dQlV^0=zrGM>2LBHJjuNy2` zx+?#NSfkO30>QtP%rS*CcasCMC5*e?Wy9*K7iZ@>0gXj!X&iZEV2fZ2b3?OBtfgmD zeZ@Xlz&$$4F7>60^=G2X?dBZo+=riT8xwx7(!uVvmeDba*!K+TYM0=ATnqR1fT?+c ze>0VvUZ>w~EEiV;7Jm~9y9p@_`jgo7sGKS+?DZ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9#weWY!@gm(Fodgqk4ab3_rmh z!X?r0*Q_EXLr-Qcg|^6BZHi8!)-QAoW|XU!3?VzypEpd8mHmUqkS zrU{%91p}{wy{CnA*dG=P;;aAjM?o;_r=dUV$BP=-xIdnc7yWS%&Y~bm?#5~SPuryKU+V3@0F#j+6tf-~ zF9QWO-R|&lvr-%;0e^17Fc7>~>OVxegF{szS}jHusOq5)Bm$f*XOmcUY|AzX{=ORm zDOG!FPCK*S@$AGfJ2X1kqYuiOX*wEaX@W-DLYZosuJh-?BuzpTrV!d1oTf(%>5Sjr zz|vcXJ}L|eNtiHA>loc5V?ox~h%ltKp-yRiBO*axFk4w_MdgL7&-Qu*D=9S2X>(o*9T3P+)FR0xVIpCzqJG zWyZJK-feZzHf=Yye{X@oMEBs^y*=lCTuz%#k7eN7J zdBzgKNFfDe=mZ8$^V^%0s)R}nuUab5mV@yeNtlGH3~jAd3C4zQp(G}74&lVL)FrWh zuGJf?2;Gql;5ZB?xCBcWu>{vZU-d+EMl#wX)m|43fKdzulpw6ZQ4rya*Mct1)qzI& z;Vij5DY$Cw#NK^0yf;==6;z|f>h_QD`~2mt`Bk5bIx7k&PZ>=tw*}-WzLc&q`_C_+ zwmt3}S5pndN}aE`V6rma(tvJEolr-AzJpUGH8XB}&^a3eLp4{{U1SR%95{DDjGeoi zU2|ZMr(fUstJfnM4!nLDc@#C4zE96Nx61+ZTs}#gW~Z!1PtS`P%HuG4@WVSl9xvi3 z8IO`M{HXUE%wK@zd4vBDCyOvn#`i;F2WTT2zR~;}009600{~D<0|XQR1^@`NpdmF3 z3b~HbR}2LJ0Aml6-z`r8B$F>LC?r_BL$CJ(008R>000pH000000000000000dlUcw zcW-iJFLRUqE*q1UE*b)%7?ZLtJ^_Z4@h&GEHr?*KFCqqxEC2ui E0PkBY{r~^~ diff --git a/project.py b/project.py index f9b67c7..3b21653 100644 --- a/project.py +++ b/project.py @@ -371,7 +371,7 @@ def __init__(self, parent): self.text = Text(self.parent, yscrollcommand = self.scrollbar.set, state = DISABLED) self.text.pack() - self.scrollbar.config( command = self.text.yview ) + self.scrollbar.config( command = self.text.yview ) self.button7 = Button(self.top_frame, text="New", command=self.createInput) self.button7.pack(side=LEFT) @@ -397,6 +397,7 @@ def __init__(self, parent): self.fileName_error = "" self.fileName_entered = False self.text2 = "" + self.scrollbar2 = "" self.table = [] self.current = -1 #current represents the state just printed out @@ -414,14 +415,18 @@ def createInput(self): self.button6.config(state = DISABLED) self.button7.config(state = DISABLED) + self.scrollbar2 = Scrollbar(self.file_window) + self.scrollbar2.pack( side = RIGHT, fill = Y ) - self.text2 = Text(self.file_window) + self.text2 = Text(self.file_window, yscrollcommand = self.scrollbar2.set) self.text2.pack() + self.scrollbar2.config(command = self.text2.yview) + file_frame = Frame(self.file_window) file_frame.pack(side = BOTTOM) self.button5 = Button(file_frame, text="Enter") - self.file_window.bind('', self.inputHelper) + self.file_window.bind('', self.inputHelper) #press enter twice to return self.button5.bind('', self.inputHelper) self.button5.pack(side = RIGHT) self.file_window.focus_force() @@ -440,9 +445,11 @@ def inputHelper(self, self2): #click open (file browser) def enterFileName(self): start = os.getcwd() + "\\inputs" - self.parent.filename = filedialog.askopenfilename(initialdir = start,title = "Select file",filetypes = (("txt files","*.txt"),("All files","*.*"))) + self.parent.filename = filedialog.askopenfilename(initialdir = start,title = "Select file",filetypes = ((".txt Files","*.txt"),("All files","*.*"))) try: - f = open(self.parent.filename).readlines() + file = open(self.parent.filename) + f = file.readlines() + file.close() self.enter_file(f) except: pass diff --git a/test.py b/test.py deleted file mode 100644 index e73151c..0000000 --- a/test.py +++ /dev/null @@ -1,21 +0,0 @@ -from tkinter import * - -def enter_file(): - print("hello") - filename = e1.get() - -file_window = Tk() - -file_frame = Frame(file_window) -file_frame.pack(side = BOTTOM) - - - -l1 = Label(file_window, text="File Name") -l1.pack( side = LEFT) -e1 = Entry(file_window, bd =5) -e1.pack(side = RIGHT) -button = Button(file_frame, text="Enter", command=enter_file) -button.pack() - -file_window.mainloop() From fe0f6d46f5fa01e4c67e17191e35903661fc01c9 Mon Sep 17 00:00:00 2001 From: Salil Chandra Date: Sat, 27 Apr 2019 11:53:24 -0400 Subject: [PATCH 36/36] Added pdf --- Writeup 2019.pdf | Bin 0 -> 4480 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Writeup 2019.pdf diff --git a/Writeup 2019.pdf b/Writeup 2019.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5e95bc1731f6c9750764ac5adf52a6bf5cf95464 GIT binary patch literal 4480 zcmc&&dpuO>8=pxwDWz6Pq(g~pI_J!sxkYN+$w-FWt1%A7Wkxe+ifX&brrJ$PLP?4h zi_JA@D@w7EP1#b?cBPe#-O|N|-+N|K#D4bk`{Vcdo%1>KzUO(L+xxuFd%n**My@t? zX6QnOhPqKHxHQyJ2!SL4p&IHI7O;DCBo12(2tl|c7AQp$_4}ocj3E+?n!j#&j5_u%BrwFP&`2zD{cd0-uizFQvM#I*8*alxG z65?+5RzR=2AV3CKl;KrQP6i=E<3K7NjDwvhoWP~9T{xJP4K9=f;;=I=4kkh%6hoP$ zl#Gz#f(Q-us3WCbJV}e4=D7*iw~&ttd=XOG-rN$%HcF1%3rgXf|2g8LU#yL!T+UcOfEKjLEXuyJ+U zxCh*C2M#RQT9)jxxsTdJ{1s%G=6C)jb$0#jo4exoSachV-=V!@UsOuBTe4(reDTh6(ff)Nm(4P9YYHJ{5xM&dOv|Og8O0gqp})3?ANf_vPgkcO9y3rHdGKs; z?H%SB(|gT1rsoFMCvQo1DQL`I{r!P~&P|YTN^o{V@h>qybT_H{ZK)W;u4))q)j4MM zZU?I)4pY7eZqv!(wZ29qt+jW0bd%c)i0K~G(~QTbg5&OacP@SKPG?iZO3wBs?WFDm zZ`0%TPaZ6LJNCCd@m*OC3*&IZBKq@}ygS^Rx84+Vg-wjJ_I2%{##xqj$TGd!PEJx| zmcMhd+0fM+buP26EHaqd)v;$A$y9duPU3=eF~$ zZ?`AkuPuql=$-UJ&&Sr`RA4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