Advertisement
Guest User

Mr.

a guest
Mar 25th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.88 KB | None | 0 0
  1. #callMDI.pyw
  2. import sys
  3.  
  4. from MDI1 import *
  5.  
  6. class MyForm(QtGui.QMainWindow):
  7.     def __init__(self, parent=None):
  8.         QtGui.QWidget.__init__(self, parent)
  9.         self.ui = Ui_MainWindow()
  10.         self.ui.setupUi(self)
  11.         self.ui.mdiArea.addSubWindow(self.ui.subwindow)
  12.         self.ui.mdiArea.addSubWindow(self.ui.subwindow_2)
  13.         QtCore.QObject.connect(self.ui.showNext, QtCore.SIGNAL('clicked()'),self.displayNext)
  14.         QtCore.QObject.connect(self.ui.showPrevious, QtCore.SIGNAL('clicked()'),self.displayPrevious)
  15.         QtCore.QObject.connect(self.ui.closeAll, QtCore.SIGNAL('clicked()'),self.closeAll)
  16.         QtCore.QObject.connect(self.ui.cascadeButton, QtCore.SIGNAL('clicked()'),self.cascadeArrange)
  17.         QtCore.QObject.connect(self.ui.tileButton, QtCore.SIGNAL('clicked()' ),self.tileArrange)
  18.         QtCore.QObject.connect(self.ui.SubWindowViewButton,
  19.         QtCore.SIGNAL('clicked()'), self.SubWindowView)
  20.         QtCore.QObject.connect(self.ui.TabbedViewButton, QtCore.SIGNAL('clicked()'),self.TabbedView)
  21.         self.connect(self.ui.actionFirst_Window, QtCore.SIGNAL('triggered()' ),self.displayNext)
  22.         self.connect(self.ui.actionSecond_Window, QtCore.SIGNAL('triggered()'),self.displayPrevious)
  23.  
  24.     def displayNext(self):
  25.         self.ui.mdiArea.activateNextSubWindow()
  26.     def displayPrevious(self):
  27.         self.ui.mdiArea.activatePreviousSubWindow()
  28.     def closeAll(self):
  29.         self.ui.mdiArea.closeAllSubWindows()
  30.     def cascadeArrange(self):
  31.         self.ui.mdiArea.cascadeSubWindows()
  32.     def tileArrange(self):
  33.         self.ui.mdiArea.tileSubWindows()
  34.     def SubWindowView(self):
  35.         self.ui.mdiArea.setViewMode(0)
  36.     def TabbedView(self):
  37.         self.ui.mdiArea.setViewMode(1)
  38.        
  39. if __name__ == "__main__":
  40.     app = QtGui.QApplication(sys.argv)
  41.     myapp = MyForm()
  42.     myapp.show()
  43.     sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement