Category : pyqt

code: def open_file(self): filename = QFileDialog.getOpenFileName(self, ‘Open File’, expanduser("~")) try: with open(filename[0], ‘r’) as f: text = f.read() self.path = filename[0] self.textEdit.setPlainText(text) self.setWindowTitle(f'{filename[0]} – QtNotepad’) except Exception as e: error = QDialog(str(e)) error.show() pass If I choose to close the file dialog using the top right corner X or the close button the application shuts ..

Read more

for my code i need to switch between two windows ("window" and "search window") by pressing a button ("search button" and "home button") but the problem is, the "search window" appears visually and then closes immediately. What the issue might be? Thank you! class Window(QMainWindow): def __init__(self): super(Window, self).__init__() self.setGeometry(200, 50, 468, 936) self.search_button = ..

Read more

I’m making a chat application. i want to create when client 1 sends to client 2 but client 2 doesn’t have a chat room named client 1 then it automatically appears in client app 2 chat room with client 1. I have tried several ways, it keeps producing error QObject::setParent: Cannot set parent, new parent ..

Read more