MCPcopy Create free account
hub / github.com/ActiveState/code / textwindow

Function textwindow

recipes/Python/579107_simplify_webpage/recipe-579107.py:148–168  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

146 return res
147
148def textwindow(url):
149 title = url
150 h = html2text.HTML2Text()
151 h.ignore_links = True
152 h.ignore_images = True
153 s = gethtml(url)
154 s = h.handle(s)
155 s = h.unescape(s)
156 text = convert65536(s)
157 top = Tkinter.Toplevel()
158 top.geometry("+200+100")
159 top.title(title)
160 top.bind("<Escape>", lambda _ : top.destroy())
161 S = Tkinter.Scrollbar(top)
162 customFont = tkFont.Font(family="Arial", size=16)
163 T = TextPlus(top,height=20,width=78,font=customFont,bg="lightgrey")
164 S.pack(side=Tkinter.RIGHT,fill=Tkinter.Y)
165 T.pack(side=Tkinter.LEFT,fill=Tkinter.Y)
166 S.config(command=T.yview)
167 T.config(yscrollcommand=S.set)
168 T.insert(Tkinter.END,text)
169
170def main():
171 root = Tkinter.Tk()

Callers 2

handleFunction · 0.85
handlereturnFunction · 0.85

Calls 10

gethtmlFunction · 0.85
convert65536Function · 0.85
TextPlusClass · 0.85
unescapeMethod · 0.80
handleMethod · 0.45
titleMethod · 0.45
bindMethod · 0.45
destroyMethod · 0.45
packMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected