36 lines
802 B
Python
36 lines
802 B
Python
from PyQt5.QtWidgets import QMdiArea, QMdiSubWindow, QAction
|
|
from PyQt5.QtWidgets import QTextEdit
|
|
|
|
|
|
class MDIArea(QMdiArea):
|
|
|
|
def __init__(self, bar, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
|
|
menu = bar.addMenu("View")
|
|
menu.addAction("Cascade")
|
|
menu.addAction("Tiled")
|
|
menu.triggered[QAction].connect(self.on_menu_select)
|
|
|
|
|
|
def on_menu_select(self, p):
|
|
txt = p.text()
|
|
if txt == "Cascade":
|
|
self.cascadeSubWindows()
|
|
elif txt == "Tiled":
|
|
self.tileSubWindows()
|
|
|
|
|
|
|
|
class MDISubWindow(QMdiSubWindow):
|
|
|
|
def __init__(self, title, data, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.setWindowTitle(title)
|
|
|
|
txt = QTextEdit(str(data))
|
|
self.setWidget(txt)
|
|
|
|
|
|
|