Can you help me find the error?
-
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
-
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
@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. -
@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.