Skip to content

Commit

Permalink
Merge branch 'main' into resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
KKhaghani authored May 4, 2021
2 parents 5910f06 + 28a0ce8 commit e4ba62c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
13 changes: 6 additions & 7 deletions gui_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from resolution_canvas import ResolutionCanvas
from statement_frame import StatementFrame
from resolution_engine import ResolutionEngine
from info_window import InfoWindow

class ResolutionGUI():
def __init__(self):
Expand Down Expand Up @@ -42,13 +43,11 @@ def __init__(self):

# used to display the help menu
def get_help(self, *args):
help_window = Toplevel(self.root)
help_window.title("Help Window")
help_text = "Error..."
with open('help.txt', 'r') as f:
help_text = f.read()
label = ttk.Label(help_window, text=help_text)
label.grid(padx=10, pady=10)
help_window = InfoWindow(self.root, "Help Window", "help.txt", file=True)

# used to display an error to the user
def show_error(self, error_text):
error_window = InfoWindow(self.root, "Error Window!", error_text)

def update_clause_premise(self, index, conclusion=False):
# get the clause frame that is selected
Expand Down
22 changes: 22 additions & 0 deletions info_window.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from tkinter import *
from tkinter import ttk

class InfoWindow:
def __init__(self, master, title, text_or_file, file=False):
window = Toplevel(master)
window.title(title)
window.grid_columnconfigure(0, weight=1)
window.grid_rowconfigure(0, weight=1)

s = ttk.Sizegrip(window)
s.grid(column=1, row=1, sticky=(S,E))

text = text_or_file
if file:
with open(text_or_file, 'r') as f:
text = f.read()

label = Text(window, wrap="word")
label.insert("1.0", text)
label.configure(state="disabled")
label.grid(row=0, column=0, padx=10, pady=10, sticky=(N,S,E,W))

0 comments on commit e4ba62c

Please sign in to comment.