Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2421

QWebEngineView.print() in Python3

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.5.2
    • 6.5.2
    • PySide
    • None
    • Python-3.11
      PySide6-6.5.2
      windows-11
    • Linux/X11, Windows

    Description

      Error code: 0xC0000005 or 0xC0000409.

      The error code appears to be random.

      from PySide6 import QtWidgets, QtCore
      from PySide6.QtPrintSupport import QPrinter, QPrintDialog
      from PySide6.QtWebEngineWidgets import QWebEngineView
      import PySide6
      print(PySide6.__version__)  # 6.5.2     windows11
      
      
      def printing():
          printer = QPrinter()
          printer.setPageMargins(QtCore.QMarginsF(0, 0, 0, 0))
          pd = QPrintDialog(printer, Qt)
          if pd.exec():
              view.print(printer)  # error 0xC0000005 or 0xC0000409 
      
      
      App = QtWidgets.QApplication([])
      QtWidgets.QApplication.setStyle("Fusion")
      Qt = QtWidgets.QMainWindow()
      Qt.resize(700, 500)
      
      lw = QtWidgets.QWidget()
      ll = QtWidgets.QGridLayout(lw)
      
      view = QWebEngineView(lw)
      view.load(QtCore.QUrl("https://www.bing.com"))
      
      bt = QtWidgets.QPushButton(lw)
      bt.clicked.connect(printing)
      bt.setText("print")
      
      ll.addWidget(view, 0, 0)
      ll.addWidget(bt, 1, 0)
      Qt.setCentralWidget(lw)
      
      Qt.show()
      App.exec()

      This does not appear to be an error caused by the printer.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            shpremna Shyamnath Premnadh
            feiyun Fei Yun
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes