Shows how to add a custom python widget to the mdi-area of OpenStructure.
19 from PyQt5
import QtGui, QtCore, QtWidgets
24 class Points(QtWidgets.QWidget):
25 def __init__(self, parent=None):
26 QtWidgets.QWidget.__init__(self, parent)
27 self.setWindowTitle(
'Some Points')
29 def paintEvent(self, event):
30 paint = QtGui.QPainter()
33 paint.setPen(QtCore.Qt.red)
35 x = random.randint(1, size.width()-1)
36 y = random.randint(1, size.height()-1)
38 paint.setPen(QtCore.Qt.green)
40 x = random.randint(1, size.width()-1)
41 y = random.randint(1, size.height()-1)
43 paint.setPen(QtCore.Qt.blue)
45 x = random.randint(1, size.width()-1)
46 y = random.randint(1, size.height()-1)
51 app=gui.GostyApp.Instance()
54 main_area=app.perspective.main_area
56 pts=Points(main_area.qobject)
59 main_area.AddWidget(
"Some Points", pts)