Initial simple dialog for information about the program

This commit is contained in:
Mr Finchum 2025-01-02 18:52:46 +01:00
parent e03a49a713
commit 01823f50d6

30
ui/simple_dialog.py Normal file
View file

@ -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