From 01823f50d6817adb1d1b49ec6ada138f4fe13a39 Mon Sep 17 00:00:00 2001 From: CodeByMrFinchum Date: Thu, 2 Jan 2025 18:52:46 +0100 Subject: [PATCH] Initial simple dialog for information about the program --- ui/simple_dialog.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 ui/simple_dialog.py diff --git a/ui/simple_dialog.py b/ui/simple_dialog.py new file mode 100644 index 0000000..b4a230b --- /dev/null +++ b/ui/simple_dialog.py @@ -0,0 +1,30 @@ +from PySide6.QtWidgets import QApplication, QDialog, QVBoxLayout, QLineEdit, QPushButton, QLabel +# ChatGPT +class SimpleDialog(QDialog): + def __init__(self): + super().__init__() + + # Set default properties + self.setGeometry(100, 100, 300, 100) + + # Create the layout + layout = QVBoxLayout() + + # Create the label for the message + self.message_label = QLabel(self) + + # Create the close button + close_button = QPushButton("Close", self) + close_button.clicked.connect(self.close) + + # Add widgets to layout + layout.addWidget(self.message_label) + layout.addWidget(close_button) + + # Set layout for the dialog + self.setLayout(layout) + + def show_dialog(self, title: str, message: str): + self.setWindowTitle(title) # Set the window title + self.message_label.setText(message) # Set the message text + self.exec() # Open the dialog as a modal window