Does anyone know how to use twisted and tkinter. I have a simple tcp server and I want to send messages to it once connected using a tkinter button? I have built the code as far as I can but don't know what to do from here. Any reference I try to put to sendmessage in chatfactory doesn't seem to work, just brings up error messages. This is my code:
from twisted.internet import reactor from twisted.internet.protocol import Protocol, ClientFactory from twisted.protocols.basic import LineReceiver from Tkinter import * from twisted.internet import tksupport class ChatClient(LineReceiver): def connectionMade(self): self.sendLine("Hello server") def lineReceived(self, line): pass def connectionLost(self, reason): pass class ChatFactory(ClientFactory): protocol = ChatClient def clientConnectionFailed(self, connector, reason): reactor.stop() def clientConnectionLost(self, connector, reason): reactor.stop() def sendMessage(self): self.sendLine("Test") root = Tk() b1 = Button(root,text="Send") #b1.configure(command=sendline to server here) b1.pack() tksupport.install(root) reactor.connectTCP('localhost',4567,ChatFactory()) reactor.run() -- http://mail.python.org/mailman/listinfo/python-list