May 2019
Intermediate to advanced
542 pages
13h 37m
English
Let's begin by creating a basic GUI form that we can use for both versions of the chat application. Start with the application template from Chapter 4, Building Applications with QMainWindow, and add this class:
class ChatWindow(qtw.QWidget): submitted = qtc.pyqtSignal(str) def __init__(self): super().__init__() self.setLayout(qtw.QGridLayout()) self.message_view = qtw.QTextEdit(readOnly=True) self.layout().addWidget(self.message_view, 1, 1, 1, 2) self.message_entry = qtw.QLineEdit() self.layout().addWidget(self.message_entry, 2, 1) self.send_btn = qtw.QPushButton('Send', clicked=self.send) self.layout().addWidget(self.send_btn, 2, 2)
The GUI is pretty simple, just a text edit to display the conversation, a line edit to ...
Read now
Unlock full access