import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel from PyQt5.QAxContainer import QAxWidget # from PyQt6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel # from PyQt6.QAxContainer import QAxWidget # from PySide2.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel # from PySide2.QtAxContainer import QAxWidget # from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget, QLabel # from PySide6.QtAxContainer import QAxWidget class MainForm(QMainWindow): def __init__(self, parent=None): super(MainForm, self).__init__(parent) self.widget = QWidget() self.layout = QVBoxLayout() # Microsoft InkEdit Control self.axWidget = QAxWidget("E5CA59F5-57C4-4DD8-9BD6-1DEEEDD27AF4") with open("doc.html", "w") as file: file.write(self.axWidget.generateDocumentation()) # OK with PyQt5 # PyQt6, PySide2, PySide6 raise AttributeError self.axWidget.TextRTFChanged.connect(self.get_text) # self.label = QLabel() self.layout.addWidget(self.axWidget) self.layout.addWidget(self.label) self.widget.setLayout(self.layout) self.setCentralWidget(self.widget) # parameter text contains RTF -> displaying plain text using ActiveX property def get_text(self, text): self.label.setText(self.axWidget.property("Text")) def main(): app = QApplication(sys.argv) form = MainForm() form.resize(800, 600) form.show() app.exec() if __name__ == '__main__': main()