createfilehandler, how to use it with Tk?

algaba at my-deja.com algaba at my-deja.com
Mon Jul 26 10:58:08 EDT 1999


I have to communicate a tk front end with another modules.
And I'm trying:
... tk-inter code

class lectora:
    def __init__(self):
	from socket import *
	HOST = ''    # The remote host
	PORT = 50008              # The same port as used by the server
	self.s = socket(AF_INET, SOCK_STREAM)
	self.s.connect(HOST, PORT)
	self.s.send('Hello, world')

    def el_socket(self, handle, event):
	pass
        #data = handle.recv(1024)

    def close(self):
	self.s.close()
	print 'Received', `data`

l = lectora()

tk_mask =  _tkinter.READABLE

_tkinter.createfilehandler(l.s, tk_mask, l.el_socket )

test = Test()
test.mainloop()

But this segfaults. :(

I've been browsing  fnorb example of use of createfilehandler
, but it's as complex as hell.
has anyone a simple,straightforward example of it?

Thanks


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




More information about the Python-list mailing list