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. Can you help me find the error?
Forum Updated to NodeBB v4.3 + New Features

Can you help me find the error?

Scheduled Pinned Locked Moved Unsolved QtWebEngine
4 Posts 2 Posters 417 Views 1 Watching
  • 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.
  • E Offline
    E Offline
    Erdium
    wrote on last edited by Erdium
    #1
    I don't know anything about the software, so I keep getting an error. Can you help me solve this error?
    
    Code:
    

    code_text

    from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout 
    from PyQt5.QtWidgets import QApplication, QMainWindow
    from PyQt5.QtWebEngineWidgets import QWebEngineView
    
    class MainWindows(QMainWindow):
        def __init__(self):
            super(MainWindows, self).__init__()
            self.browser = QWebEngineView
            self.browser.setUrl('http://google.com')
            self.setCentralWidget(self.browser)
            self.showMaximized()
            
    app = QApplication(sys.argv)
    QApplication.setApplicationDisplayName("Erdser")
    windows = MainWindows()
    app.exec_()
    
    Error:
    Traceback (most recent call last):
      File "c:\Users\****\Desktop\browser\benimtaraicim.py", line 16, in <module>
        windows = MainWindows()
                  ^^^^^^^^^^^^^
      File "c:\Users\****\Desktop\browser\benimtaraicim.py", line 10, in __init__
        self.browser.setUrl('http://google.com')
    TypeError: setUrl(self, QUrl): first argument of unbound method must have type 'QWebEngineView'
    

    NOTE: I made this code by looking at YouTube. I'm making a browser

    JonBJ 1 Reply Last reply
    0
    • E Erdium
      I don't know anything about the software, so I keep getting an error. Can you help me solve this error?
      
      Code:
      

      code_text

      from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout 
      from PyQt5.QtWidgets import QApplication, QMainWindow
      from PyQt5.QtWebEngineWidgets import QWebEngineView
      
      class MainWindows(QMainWindow):
          def __init__(self):
              super(MainWindows, self).__init__()
              self.browser = QWebEngineView
              self.browser.setUrl('http://google.com')
              self.setCentralWidget(self.browser)
              self.showMaximized()
              
      app = QApplication(sys.argv)
      QApplication.setApplicationDisplayName("Erdser")
      windows = MainWindows()
      app.exec_()
      
      Error:
      Traceback (most recent call last):
        File "c:\Users\****\Desktop\browser\benimtaraicim.py", line 16, in <module>
          windows = MainWindows()
                    ^^^^^^^^^^^^^
        File "c:\Users\****\Desktop\browser\benimtaraicim.py", line 10, in __init__
          self.browser.setUrl('http://google.com')
      TypeError: setUrl(self, QUrl): first argument of unbound method must have type 'QWebEngineView'
      

      NOTE: I made this code by looking at YouTube. I'm making a browser

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Erdium said in Can you help me find the error?:

      I don't know anything about the software

      That is not a great way to go!

      self.browser = QWebEngineView

      That is wrong in Python. You meant self.browser = QWebEngineView().

      If you post code again, please make the effort to encode it in the forum's Code tags (</> icon when posting a message), especially for Python where indentation is vital.

      E 1 Reply Last reply
      2
      • JonBJ JonB

        @Erdium said in Can you help me find the error?:

        I don't know anything about the software

        That is not a great way to go!

        self.browser = QWebEngineView

        That is wrong in Python. You meant self.browser = QWebEngineView().

        If you post code again, please make the effort to encode it in the forum's Code tags (</> icon when posting a message), especially for Python where indentation is vital.

        E Offline
        E Offline
        Erdium
        wrote on last edited by
        #3

        @JonB I don't understand what to do to solve the problem. Can you explain a little more?

        JonBJ 1 Reply Last reply
        0
        • E Erdium

          @JonB I don't understand what to do to solve the problem. Can you explain a little more?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Erdium I wrote what line you have that is wrong and what it should read.

          1 Reply Last reply
          1

          • Login

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