def onConnect(self, evt):
        """Called from connect button. Connects to a server"""
        if evt.Checked():
            self.client.connect(self.edtIPAddress.GetValue(), self.spnConnectPort.GetValue(),
                                self.onClientConnected, self.onClientFailed, self.onLine,
                                self.onClientMsg)
        else:
            self.client.disconnect(lambda tc: self.onClientMsg('Client disconnected'), self.onClientFailed)
Called from connect button. Connects to a server
recipes/Python/286201_wx_twisted_support_using_threads/recipe-286201.py