Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. PyQt5 browser gives fatal error when joining online games

PyQt5 browser gives fatal error when joining online games

Scheduled Pinned Locked Moved Unsolved Qt for Python
1 Posts 1 Posters 673 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.
  • D Offline
    D Offline
    Devappl
    wrote on last edited by
    #1

    Here is the error I am getting (in the last line some numbers always change, I have replaced them with "-", the amount of digits is still accurate though):

    <--- Last few GCs --->
    
    
    <--- JS stacktrace --->
    
    [65646:-----:0207/------.------:FATAL:v8_initializer.cc(765)]
    

    This error shows up when I tried to join several online games (e.g. bloxd.io, deadshot.io).
    (some other errors also appear, but seem to fix themselves after a few seconds, an example:

    js: The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
    

    )

    There was one exception though where I was able to join (kirka.io), which leads me to believe this might just be bad developing on the game owner's end.

    I tried upgrading to PyQt6, but that also didn't fix the problem. If anybody needs it, my full code is below.

    import sys
    from PyQt5.QtWidgets import *
    from PyQt5.QtCore import *
    from PyQt5.QtWebEngineWidgets import *
    
    class BloxdWebBrowser():
        
        def __init__(self, initial_url=None):
            self.window = QWidget()
            self.window.setWindowTitle("Bloxd Client")
            
            self.layout = QVBoxLayout()
            self.horizontal = QHBoxLayout()
            
            self.url_bar = QTextEdit()
            self.url_bar.setMaximumHeight(30)
            
            self.go_btn = QPushButton("Go")
            self.go_btn.setMinimumHeight(30)
            
            self.back_btn = QPushButton("<")
            self.back_btn.setMinimumHeight(30)
            
            self.forward_btn = QPushButton(">")
            self.forward_btn.setMinimumHeight(30)
            
            self.home_btn = QPushButton("bloxd.io")
            self.home_btn.setMinimumHeight(30)
            
            self.staging_btn = QPushButton("staging.bloxd.io")
            self.staging_btn.setMinimumHeight(30)
            
            self.horizontal.addWidget(self.back_btn)
            self.horizontal.addWidget(self.forward_btn)
            self.horizontal.addWidget(self.url_bar)
            self.horizontal.addWidget(self.go_btn)
            self.horizontal.addWidget(self.home_btn)
            self.horizontal.addWidget(self.staging_btn)
            
            self.browser = QWebEngineView()
            
            self.go_btn.clicked.connect(lambda: self.navigate(self.url_bar.toPlainText()))
            self.back_btn.clicked.connect(self.browser.back)
            self.forward_btn.clicked.connect(self.browser.forward)
            
            self.home_btn.clicked.connect(lambda: self.navigate("http://bloxd.io"))
            self.staging_btn.clicked.connect(lambda: self.navigate("http://staging.bloxd.io"))
            
            self.layout.addLayout(self.horizontal)
            self.layout.addWidget(self.browser)
            
            self.window.setLayout(self.layout)
    
            if initial_url:
                self.navigate(initial_url)
            else:
                self.browser.setUrl(QUrl("https://bloxd.io"))
            
            self.window.show()
            
        def navigate(self, url):
            if not url.startswith("http"):
                url = "http://" + url
                self.url_bar.setText(url)
            self.browser.setUrl(QUrl(url))
    
    if __name__ == "__main__":
        app = QApplication(sys.argv)
        
        initial_url = None
        if len(sys.argv) > 1:
            initial_url = sys.argv[1]
    
        client = BloxdWebBrowser(initial_url)
        sys.exit(app.exec_())
    
    
    1 Reply Last reply
    0

    • Login

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