PySide: [skip ci] add minimal example of embedding
This commit is contained in:
25
src/Tools/embedded/PySide/minimal.py
Normal file
25
src/Tools/embedded/PySide/minimal.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import sys
|
||||
from PySide2 import QtCore, QtGui, QtWidgets
|
||||
import FreeCAD, FreeCADGui
|
||||
|
||||
class MainWindow(QtWidgets.QMainWindow):
|
||||
def showEvent(self, event):
|
||||
FreeCADGui.showMainWindow()
|
||||
self.setCentralWidget(FreeCADGui.getMainWindow())
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
mw = MainWindow()
|
||||
mw.resize(1200,800)
|
||||
mw.show()
|
||||
|
||||
# must be done a few times to update the GUI
|
||||
app.processEvents()
|
||||
app.processEvents()
|
||||
app.processEvents()
|
||||
|
||||
import Part
|
||||
cube = Part.makeBox(2,2,2)
|
||||
# creates a document and a Part feature with the cube
|
||||
Part.show(cube)
|
||||
app.processEvents()
|
||||
app.processEvents()
|
||||
Reference in New Issue
Block a user