Files
detektor/src/generic_dialog.py
2025-03-10 17:10:04 +01:00

28 lines
709 B
Python

from PyQt6.QtWidgets import QDialog, QVBoxLayout, QPushButton, QHBoxLayout, QLabel
class GenericDialog(QDialog):
def __init__(self, title="Dialog", text="Toto je dialog", ok_button="OK"):
super().__init__()
self.setWindowTitle(title)
layout = QVBoxLayout()
self.setLayout(layout)
message_label = QLabel(text)
layout.addWidget(message_label)
# Button layout (horizontal)
button_layout = QHBoxLayout()
ok_button = QPushButton(ok_button)
ok_button.clicked.connect(self.ok)
button_layout.addWidget(ok_button)
layout.addLayout(button_layout)
self.exec()
def ok(self):
super().accept()