python - PyQt WebEngineView interferes with MainMenu -
i'm trying create application contains web browser within it, when add web browser menu bar visually disappears functionally remains in place. following 2 images, 1 showing "self.centralwidget(self.web_widget)" commented out, , other allows line run. if run example code, see while visually entire web page appears if menu bar wasn't present, have click below each entry field , button in order activate it, behaving if menu bar in fact present.
example code
import os import sys pyqt5.qtwidgets import * pyqt5.qtcore import * pyqt5.qtwebenginewidgets import * class webpage(qwebengineview): def __init__(self, parent=none): qwebengineview.__init__(self) self.current_url = '' self.load(qurl("https://facebook.com")) self.loadfinished.connect(self._on_load_finished) def _on_load_finished(self): print("url loaded") class mainwindow(qmainwindow): def __init__(self, parent=none): # initialize main window super(mainwindow, self).__init__(parent) self.create_menu() self.add_web_widet() self.show() def create_menu(self): ''' creates main menu ''' self.main_menu = self.menubar() self.main_menu_actions = {} self.file_menu = self.main_menu.addmenu("example file menu") self.file_menu.addaction(qaction("testing testing", self)) def add_web_widet(self): self.web_widget = webpage(self) self.setcentralwidget(self.web_widget) if __name__ == "__main__": app = qapplication(sys.argv) main_window = mainwindow() main_window.showmaximized() sys.exit(app.exec_()) # need 1 app, 1 running event loop
development environment windows 10, pyqt5, pyqt5-5.9
edit
the problem doesn't seem directly related menu bar. removing menu bar issue still occurs. said, changing showmaximized() showfullscreen() seem solve problem.
i no longer believe issue pyqt5 rather problem graphics driver. specifically, if @ atlassian's hipchat application has similar problem documented here: https://jira.atlassian.com/browse/hcpub-3177
some individuals able solve problem running application command prompt addendum "--disable-gpu" didn't work python application. on other hand, rolling intel(r) hd graphics driver did solve problem. version 21.20.16.4627 1 seems causing problems.
Comments
Post a Comment