Ditched '_find_SET()', since it was a no-value-added wrapper around
[python/dscho.git] / Demo / tkinter / www / www6.py
bloba8824facc33ffe112f6a5ce6a149d7b3586f9da2
1 #! /usr/bin/env python
3 # www6.py -- display the contents of a URL in a Text widget
4 # - set window title
5 # - make window resizable
7 import sys
8 import urllib
9 from Tkinter import *
11 def main():
12 if len(sys.argv) != 2 or sys.argv[1][:1] == '-':
13 print "Usage:", sys.argv[0], "url"
14 sys.exit(2)
15 url = sys.argv[1]
16 fp = urllib.urlopen(url)
18 root = Tk()
19 root.title(url)
20 root.minsize(1, 1) # Set minimum size
21 text = Text(root)
22 text.pack({'expand': 1, 'fill': 'both'}) # Expand into available space
24 while 1:
25 line = fp.readline()
26 if not line: break
27 text.insert('end', line)
29 root.mainloop() # Start Tk main loop (for root!)
31 main()