Created
October 21, 2018 20:50
-
-
Save takavfx/de8c6074b6dff17107f60bf635ff9f95 to your computer and use it in GitHub Desktop.
This file contains 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 PySide import QtCore, QtGui | |
import sys | |
class MainWindow(QtGui.QMainWindow): | |
def __init__(self): | |
super(MainWindow, self).__init__() | |
self.initUI() | |
def initUI(self): | |
baseWidget = QtGui.QWidget() | |
self.setCentralWidget(baseWidget) | |
button = QtGui.QPushButton('Dialog') | |
button.clicked.connect(self.openDialog) | |
layout = QtGui.QVBoxLayout() | |
layout.addWidget(button) | |
baseWidget.setLayout(layout) | |
self.resize(500, 300) | |
def openDialog(self): | |
dialog = QtGui.QDialog(self, QtCore.Qt.CustomizeWindowHint | QtCore.Qt.WindowTitleHint) | |
dialog.resize(200,300) | |
buttonBox = QtGui.QDialogButtonBox(dialog) | |
buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) | |
QtCore.QObject.connect(buttonBox, QtCore.SIGNAL("accepted()"), self.saveConfig) | |
QtCore.QObject.connect(buttonBox, QtCore.SIGNAL("rejected()"), dialog.reject) | |
dialog.show() | |
def saveConfig(self): | |
print('test') | |
def main(*argv): | |
app = QtGui.QApplication(sys.argv).instance() | |
if app is None: | |
app = QtGui.QApplication() | |
ui = MainWindow() | |
ui.show() | |
app.exec_() | |
if __name__ == '__main__': | |
main(sys.argv[1:]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment