Don't reference removed files in Makefile
[python/dscho.git] / Demo / tkinter / www / www6.py
bloba9b06983970273fed593ff5b3e05a1914bc311c1
1 #! /usr/local/bin/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()