-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguidemo.py
34 lines (24 loc) · 863 Bytes
/
guidemo.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
import tkinter
from spacetest import summary
def displayout():
article_url = entry.get()
try:
content = summary(article_url)
except ValueError:
content = 'Malformed URL! Please enter an actual news article.'
except TypeError:
content = 'Sorry, this news website is not supported at this time.'
finally:
output.delete('1.0', tkinter.END)
output.insert(tkinter.INSERT, content)
master = tkinter.Tk()
master.title("Article Summary Machine")
tkinter.Label(master, text="Article URL: ").grid(row=0)
entry = tkinter.Entry(master, width="107")
entry.grid(row=0, column=1)
entry.focus_set()
tkinter.Label(master, text="Summary: ").grid(row=1)
output = tkinter.Text(master)
output.grid(row=1, column=1)
tkinter.Button(master, text="Summarize!", command=displayout).grid(columnspan=2)
master.mainloop()