May 2019
Intermediate to advanced
542 pages
13h 37m
English
Back in MainWindow.__init__(), we need to add the relevant code to create our interface and connect the signals:
recipient, _ = qtw.QInputDialog.getText( None, 'Recipient', 'Specify of the IP or hostname of the remote host.') if not recipient: sys.exit() self.interface = TcpChatInterface(username, recipient) self.cw.submitted.connect(self.interface.send_message) self.interface.received.connect(self.cw.write_message) self.interface.error.connect( lambda x: qtw.QMessageBox.critical(None, 'Error', x))
Since we need a recipient, we'll ask the user using a QInputDialog. This dialog class allows you to easily query a user for a single value. In this case, we're asking for the IP address or hostname of the other ...
Read now
Unlock full access