Created
August 21, 2017 21:29
-
-
Save eyllanesc/7cf200538e182b5662552700c27b998a to your computer and use it in GitHub Desktop.
Embedding QDialog in QWidget
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
from PyQt5.QtWidgets import * | |
from PyQt5.QtCore import * | |
class MainWindow(QWidget): | |
def __init__(self): | |
super(MainWindow, self).__init__() | |
self.setWindowTitle("My own MainWindow") | |
self.fileDialog = QFileDialog(self) | |
self.fileDialog.setWindowFlags(Qt.Widget) | |
self.confirmAction = QPushButton("Press me", self) | |
mainLayout = QVBoxLayout() | |
mainLayout.addWidget(self.fileDialog) | |
mainLayout.addWidget(self.confirmAction) | |
self.setLayout(mainLayout) | |
if __name__ == '__main__': | |
import sys | |
app = QApplication(sys.argv) | |
w = MainWindow() | |
w.show() | |
sys.exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment