Twisted and Tkinter

jordan.taylor2 at gmail.com jordan.taylor2 at gmail.com
Fri Apr 28 10:40:39 EDT 2006


Fredrik is right, ChatFactory doesn't have sendLine as a method b/c it
doesn't inherit it from ClientFactory. The code: protocol = ChatClient
does do anything within ChatFactory except set the variable. Try out
these.

from twisted.protocols.basic import LineReceiver, LineReceiver.sendLine

or change class ChatFactory(ClientFactory) --- to:

class ChatFactory(ClientFactory, LineReceiver):

or tell ChatFactory that sendLine comes from LineReceiver --

class ChatFactory(ClientFactory):
    protocol = ChatClient

    def clientConnectionFailed(self, connector, reason):
        reactor.stop()

    def clientConnectionLost(self, connector, reason):
        reactor.stop()

    def sendMessage(self):
        self.LineReceiver.sendLine("Test")

I'm pretty sure that those should work.




More information about the Python-list mailing list