Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. QWebEngineView not showing on Linux Mint
Forum Updated to NodeBB v4.3 + New Features

QWebEngineView not showing on Linux Mint

Scheduled Pinned Locked Moved Solved QtWebEngine
2 Posts 1 Posters 505 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    IGaming73
    wrote on last edited by
    #1

    Hello,
    I have an issue on my Linux Mint installation with the PyQt Web View, as it doesn't show anything, just some white. It perfectly works on Windows11, but not on Linux.
    Here is the entire code:

    import PyQt5.QtWidgets as Qt
    from PyQt5 import QtCore
    import PyQt5.QtWebEngineWidgets as QtWeb
    
    class WebView(Qt.QMainWindow):
        def __init__(self):
            super().__init__()
    
            self.setWindowTitle("Web View")
            self.setGeometry(100, 100, 800, 600)
    
            self.webview = QtWeb.QWebEngineView(self)
            self.setCentralWidget(self.webview)
    
            self.webview.load(QtCore.QUrl("https://www.google.com"))
    
    if __name__ == "__main__":
        app = Qt.QApplication([])
        window = WebView()
        window.show()
        app.exec_()
    

    And here is the result:
    GlitchedWebView.png
    I'm using Linux Mint version 21.3, PyQt5 version 5.15.10 and PyQtWebEngine version 5.15.6
    Here are all the system information:
    neofetch.png
    Hope someone can help me, thanks.

    1 Reply Last reply
    0
    • I Offline
      I Offline
      IGaming73
      wrote on last edited by
      #2

      Found the problem, I'm replying if someone else got the same problem.
      I needed to put this line of code :

      os.environ["QTWEBENGINE_CHROMIUM_FLAGS"] = "--no-sandbox"
      

      And to use sys.argv when initializing the app :

       App = Qt.QApplication(sys.argv)
      

      The final code being the following :

      import PyQt5.QtWidgets as Qt
      from PyQt5 import QtCore
      import PyQt5.QtWebEngineWidgets as QtWeb
      import sys
      import os
      
      class WebView(Qt.QMainWindow):
          def __init__(self):
              super().__init__()
      
              self.setWindowTitle("Web View")
              self.setGeometry(100, 100, 800, 600)
      
              self.webview = QtWeb.QWebEngineView(self)
              self.setCentralWidget(self.webview)
      
              self.webview.load(QtCore.QUrl("https://www.google.com"))
      
      if __name__ == "__main__":
          os.environ["QTWEBENGINE_CHROMIUM_FLAGS"] = "--no-sandbox"
          App = Qt.QApplication(sys.argv)
          window = WebView()
          window.show()
          app.exec_()
      

      Hope it helps if someone gets the same issue !

      1 Reply Last reply
      0
      • I IGaming73 has marked this topic as solved on

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved