Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在浏览器窗口中呈现PyQt小部件_Python_Python 3.x_Pyqt_Chromium_Pyqt5 - Fatal编程技术网

Python 在浏览器窗口中呈现PyQt小部件

Python 在浏览器窗口中呈现PyQt小部件,python,python-3.x,pyqt,chromium,pyqt5,Python,Python 3.x,Pyqt,Chromium,Pyqt5,我知道我能够在webview中加载PyQt5小部件,如下所示: import sys from PyQt5 import QtCore, QtWebKitWidgets, QtWebKit from PyQt5.QtWidgets import QApplication, QCalendarWidget HTML = """ <html> <head> <title>QtWebKit Plug-in Te

我知道我能够在webview中加载PyQt5小部件,如下所示:

import sys

from PyQt5 import QtCore, QtWebKitWidgets, QtWebKit
from PyQt5.QtWidgets import QApplication, QCalendarWidget


    HTML = """
    <html>
       <head>
          <title>QtWebKit Plug-in Test</title>
       </head>
       <body>
          <h1>Hello, World!</h1>
          <object type="application/x-qt-plugin" classid="MyCalendarWidget" name="calendar" height=300 width=500></object>
          <script>
             calendar.setGridVisible(true);
             calendar.setCurrentPage(1985, 5);
          </script>
       </body>
    </html>
    """


    class MyWebView(QtWebKitWidgets.QWebView):

        def __init__(self, parent=None):

            super(MyWebView, self).__init__(parent)

            self._page = MyWebPage(self)
            self.setPage(self._page)


    class MyWebPage(QtWebKitWidgets.QWebPage):

        def __init__(self, parent=None):

            super(MyWebPage, self).__init__(parent)

            self.settings().setAttribute(QtWebKit.QWebSettings.PluginsEnabled, True)

        def createPlugin(self, classid, url, paramNames, paramValues):

            return MyCalendarWidget(self.view())


    class MyCalendarWidget(QCalendarWidget):

        def __init__(self, parent=None):

            super(MyCalendarWidget, self).__init__(parent)

            # Just to prove that this is being used.
            self.setFirstDayOfWeek(QtCore.Qt.Monday)


    app = QApplication(sys.argv)

    viewer = MyWebView()
    viewer.setHtml(HTML)
    viewer.show()

    app.exec_()
导入系统 从PyQt5导入QtCore、QtWebKitWidgets、QtWebKit 从PyQt5.QtWidgets导入QApplication、QCalendarWidget HTML=”“” QtWebKit插件测试 你好,世界! calendar.setGridVisible(true); 日历。setCurrentPage(1985,5); """ 类MyWebView(QtWebKitWidgets.QWebView): def uuu init uuu(self,parent=None): 超级(MyWebView,self)。\uuuuu init\uuuuuu(父级) self.\u page=MyWebPage(self) self.setPage(self.\u页) 类MyWebPage(QtWebKitWidgets.QWebPage): def uuu init uuu(self,parent=None): 超级(我的网页,自我)。\uuuuu初始化\uuuuuuuuuu(父) self.settings().setAttribute(QtWebKit.QWebSettings.PluginsEnabled,True) def createPlugin(self、classid、url、ParamName、paramValues): 返回MyCalendarWidget(self.view()) 类MyCalendarWidget(QCalendarWidget): def uuu init uuu(self,parent=None): 超级(MyCalendarWidget,self)。\uuuuu初始化\uuuuuuuu(父级) #只是为了证明这是被使用的。 self.setFirstDayOfWeek(QtCore.Qt.周一) app=QApplication(sys.argv) viewer=MyWebView() viewer.setHtml(HTML) viewer.show() app.exec()
但是,我想知道是否有任何方法可以直接在ChromiumWeb浏览器中加载PyQt小部件?我猜这目前是不可能的,但我不确定是否有我没有想到的方法可以做到这一点。

Chromium是webkit的不同webengine实现?如果是这样的话,我几乎看不到机会。Chromium是webengine与webkit的不同实现?如果是这样,我几乎看不到机会。