Advertisement
Guest User

Untitled

a guest
Dec 15th, 2022
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | Source Code | 0 0
  1. # Import the necessary PyQt modules
  2. from PyQt6 import QtCore, QtGui, QtWidgets
  3.  
  4. # Import the QLibrary class
  5. from PyQt6.QtCore import QLibrary
  6.  
  7. # Create a QLibrary instance to load the compiled C++ module
  8. cppModule = QLibrary("/path/to/compiled/cpp/module")
  9.  
  10. # Load the library
  11. cppModule.load()
  12.  
  13. # Use the Qt APIs to access the functionality in the C++ module and
  14. # create a QDockWidget to contain the C++ module's graphical interface
  15. dockWidget = QtWidgets.QDockWidget()
  16. dockWidget.setWidget(cppModule.someQWidget())
  17.  
  18. # Add the QDockWidget to your PyQt application's main window
  19. mainWindow = QtWidgets.QMainWindow()
  20. mainWindow.addDockWidget(QtCore.Qt.LeftDockWidgetArea, dockWidget)
  21.  
  22. # Show the main window
  23. mainWindow.show()
  24.  
Tags: python pyqt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement