Created
March 23, 2020 14:26
-
-
Save claudiug/5ff1da6eb7ed1b13bc2c9905ef7b7d50 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomDialog(QDialog): | |
def __init__(self, *args, **kwargs): | |
super(CustomDialog, self).__init__(*args, **kwargs) | |
self.setWindowTitle("HELLO!") | |
QBtn = QDialogButtonBox.Ok | QDialogButtonBox.Cancel | |
self.buttonBox = QDialogButtonBox(QBtn) | |
self.buttonBox.accepted.connect(self.accept) | |
self.buttonBox.rejected.connect(self.reject) | |
self.layout = QVBoxLayout() | |
self.layout.addWidget(self.buttonBox) | |
self.setLayout(self.layout) | |
class MainWindow(QMainWindow): | |
# def __init__ etc. | |
# ... not shown for clarity | |
def onMyToolBarButtonClick(self, s): | |
print("click", s) | |
dlg = CustomDialog(self) | |
if dlg.exec_(): # THIs will kill the app | |
print("Success!") | |
else: | |
print("Cancel!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment