GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing learning-python.com — learning-python.com import sys
from socket import *
from Tkinter import Tk
from PP2E.Gui.Tools.guiStreams import GuiOutput
myport = 50008
sockobj = socket(AF_INET, SOCK_STREAM)
sockobj.bind(('', myport)) # gui is server, script is client
sockobj.listen(5)
conn, addr = sockobj.accept() # wait for client to connect
sockobj.setblocking(0) # use non-blocking socket
def checkdata():
try:
print conn.recv(1024), # if ready, show text in GUI window
except error: # raises socket.error if not ready
pass # or message to sys.__stdout__
root.after(1000, checkdata) # check once per second
root = Tk()
sys.stdout = GuiOutput(root) # socket text is displayed on this
root.after(1000, checkdata)
root.mainloop() # mainloop in this GUI process only
|
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |