rendered paste bodyimport sysfrom qt import *true=1false=0class ICSMainWindow(QMainWindow): socket=QSocket(self) def __init__(self, *args): apply(QMainWindow.__init__, (self, ) + args) self.setGeometry(10,10,600,600) self.ICShost=QLineEdit("freechess.org", self) self.ICShost.setGeometry(10,10,470,20) self.ICSconnectButton=QPushButton("Connect", self) self.ICSconnectButton.setGeometry(490,10,100,20) self.ICSconsole=QTextEdit(self) self.ICSconsole.setReadOnly(true) self.ICSconsole.setGeometry(10,50,580,510) self.ICSinput=QLineEdit("",self) self.ICSinput.setGeometry(10,570,470,20) self.ICSsendButton=QPushButton("Send", self) self.ICSsendButton.setGeometry(490,570,100,20) self.connect( self.ICSsendButton, SIGNAL(clicked()), self, SLOT(sendToServer())) #ICSsocket=QSocket(self); #connect( self.ICSsocket, SIGNAL(connected()),SLOT(socketConnected()) ); #connect( self.ICSsocket, SIGNAL(connectionClosed()),SLOT(socketConnectionClosed()) ); #connect( self.ICSsocket, SIGNAL(readyRead()),SLOT(socketReadyRead()) ); #connect( self.ICSsocket, SIGNAL(error(int)),SLOT(socketError(int)) ); def ICSconnectToHost(host,port): self.ICSconsole.append("Trying to connect to the server\n"); self.ICSsocket.connectToHost( self.ICShost.text(), 5000 ); def ICSsendToServer(): #QTextStream os(socket); #os << inputText->text() << "\n"; #inputText->setText( "" ); passdef main(args): app=QApplication(args) win=ICSMainWindow() win.show() app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) app.exec_loop()if __name__=="__main__": main(sys.argv)