Skip to content

Instantly share code, notes, and snippets.

@ben-hearn-sb
Created January 8, 2016 10:38
Show Gist options
  • Save ben-hearn-sb/2b22edb528049d42fa65 to your computer and use it in GitHub Desktop.
Save ben-hearn-sb/2b22edb528049d42fa65 to your computer and use it in GitHub Desktop.
from PySide import QtGui, QtCore
import sys
class ExampleUI(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
# Main dialog that houses all our widgets and info
self.mainDialog = QtGui.QDialog()
self.mainDialog.resize(650, 550)
self.mainDialog.setWindowTitle("Exporter")
self.mainDialog.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
self.mainDialog.setStyleSheet('font-size: 8pt;')
# Buttons
btnExportSelection = QtGui.QPushButton('Export Selection')
btnExportAll = QtGui.QPushButton('Export All')
# Layouts
exportBtnLayout = QtGui.QHBoxLayout()
exportBtnLayout.addWidget(btnExportSelection)
exportBtnLayout.addWidget(btnExportAll)
masterLayout = QtGui.QVBoxLayout()
masterLayout.addLayout(exportBtnLayout)
btnExportSelection.pressed.connect(self.exportSelected)
# Set the main dialog
self.mainDialog.setLayout(masterLayout)
def show(self):
self.mainDialog.show()
def exportSelected(self):
print 'Exporting stuff here'
QtGui.QMessageBox.information(self.mainDialog, 'info', 'info here')
def main():
global window
window = ExampleUI()
window.show()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment