Advertisement
Guest User

embed_terminal_5.py

a guest
Jun 29th, 2020
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. # imports
  2. #from PyQt5 import QtWidgets, QtGui
  3. import numpy as np
  4. import pptk
  5. #import win32gui
  6. import sys
  7.  
  8. # local imports
  9. #from designer import Ui_MainWindow
  10.  
  11. import sys
  12. from PyQt5 import QtWidgets, QtGui
  13. from mainwindow import Ui_MainWindow
  14.  
  15.  
  16. class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
  17.     def __init__(self):
  18.         super(self.__class__, self).__init__()
  19.         self.setupUi(self)
  20.  
  21.         self.cloudpoint = np.random.rand(100, 3)
  22.         self.v = pptk.viewer(self.cloudpoint)                # generate the viewer window
  23.         hwnd = win32gui.FindWindowEx(0, 0, None, "viewer")   # retrieve the window ID of the viewer
  24.         self.window = QtGui.QWindow.fromWinId(hwnd)          # get the viewer inside a window
  25.  
  26.         # embed the window inside the centralwidget of the MainWindow :
  27.         self.windowcontainer = self.createWindowContainer(self.window, self.centralwidget)
  28.  
  29.         # finally, resize the container as you wish.
  30.         self.windowcontainer.resize(self.width() - 100 , self.height() - 100)
  31.  
  32.  
  33. if __name__ == '__main__':
  34.     app = QtWidgets.QApplication(sys.argv)
  35.     app.setStyle("fusion")
  36.     form = MainWindow()
  37.     form.show()
  38.     sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement