本文整理汇总了Python中PyQt5.QtWebEngineWidgets.QWebEngineView方法的典型用法代码示例。如果您正苦于以下问题:Python QtWebEngineWidgets.QWebEngineView方法的具体用法?Python QtWebEngineWidgets.QWebEngineView怎么用?Python QtWebEngineWidgets.QWebEngineView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWebEngineWidgets
的用法示例。
在下文中一共展示了QtWebEngineWidgets.QWebEngineView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mainPyQt5
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def mainPyQt5():
# 必要なモジュールのimport
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QUrl
from PyQt5.QtWebEngineWidgets import QWebEngineView
url = 'https://github.com/tody411/PyIntroduction'
app = QApplication(sys.argv)
# QWebEngineViewによるWebページ表示
browser = QWebEngineView()
browser.load(QUrl(url))
browser.show()
sys.exit(app.exec_())
示例2: openWebUI
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def openWebUI(self):
if self.device and self.device.p.get('IPAddress'):
url = QUrl("http://{}".format(self.device.p['IPAddress']))
try:
webui = QWebEngineView()
webui.load(url)
frm_webui = QFrame()
frm_webui.setWindowTitle("WebUI [{}]".format(self.device.p['FriendlyName1']))
frm_webui.setFrameShape(QFrame.StyledPanel)
frm_webui.setLayout(VLayout(0))
frm_webui.layout().addWidget(webui)
frm_webui.destroyed.connect(self.updateMDI)
self.mdi.addSubWindow(frm_webui)
self.mdi.setViewMode(QMdiArea.TabbedView)
frm_webui.setWindowState(Qt.WindowMaximized)
except NameError:
QDesktopServices.openUrl(QUrl("http://{}".format(self.device.p['IPAddress'])))
示例3: imprimirReciboPag
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def imprimirReciboPag(self):
self.documento = QWebEngineView()
self.renderTemplate(
"recibopagamento.html",
estilo=self.resourcepath('Template/estilo.css'),
cod=self.tx_Cod.text(),
descricao=self.tx_descricao.text(),
valor=self.tx_valor.text().replace('.', ','),
valor_ext=retorno(self.tx_valor.text()),
data=date.today().strftime("%d-%m-%Y")
)
self.documento.load(QUrl.fromLocalFile(
self.resourcepath("report.html")))
self.documento.loadFinished['bool'].connect(self.previaImpressao)
示例4: setupUi
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def setupUi(self, LoginWindow):
LoginWindow.setObjectName("LoginWindow")
LoginWindow.resize(501, 425)
self.centralwidget = QtWidgets.QWidget(LoginWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.webEngineView = QtWebEngineWidgets.QWebEngineView(self.centralwidget)
self.webEngineView.setUrl(QtCore.QUrl("https://www.yiban.cn/"))
self.webEngineView.setZoomFactor(1.5)
self.webEngineView.setObjectName("webEngineView")
self.gridLayout.addWidget(self.webEngineView, 0, 0, 1, 1)
LoginWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(LoginWindow)
QtCore.QMetaObject.connectSlotsByName(LoginWindow)
示例5: popupBrowser
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def popupBrowser(self):
w = QDialog(self)
w.resize(600, 500)
w.setWindowTitle('Wiki')
web = QWebEngineView(w)
web.load(QUrl('https://github.com/aerospaceresearch/visma/wiki'))
web.resize(600, 500)
web.show()
w.show()
示例6: createWindow
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def createWindow(self,
wintype: QWebEnginePage.WebWindowType) -> QWebEngineView:
"""Called by Qt when a page wants to create a new tab or window.
In case the user wants to open a resource in a new tab, we use the
createWindow handling of the main page to achieve that.
See WebEngineView.createWindow for details.
"""
return self.page().inspectedPage().view().createWindow(wintype)
示例7: __init__
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# 设置窗口标题
# self.setWindowTitle('My Browser')
# 设置窗口图标
# self.setWindowIcon(QIcon('icons/penguin.png'))
# 设置窗口大小900*600
# self.resize(900, 600)
# self.show()
# 2
self.view = QWebEngineView()
channel = QWebChannel()
handler = CallHandler()
channel.registerObject('handler', handler)
self.view.page().setWebChannel(channel)
self.view.loadFinished.connect(self._loadFinish)
# 添加浏览器到窗口中
# self.setCentralWidget(self.view)
#
htmlUrl = 'file:////Users/play/github/Python_Master_Courses/GUI图形界面/pyqt5/pyqt5-javascript-互相传值/js1.html'
self.view.load(QUrl(htmlUrl))
self.view.show()
# 3
示例8: __init__
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def __init__(self, *args, **kw):
url = kw.pop('url', None)
first = False
if not url:
url = get_authenticated_url()
first = True
self.url = url
self.closing = False
super(QWebView, self).__init__(*args, **kw)
self.setWindowTitle('Bitmask')
self.bitmask_browser = NewPageConnector(self) if first else None
self.loadPage(self.url)
self.bridge = AppBridge(self) if first else None
if self.bridge is not None and HAS_WEBENGINE:
print "[+] registering python<->js bridge"
channel = QWebChannel(self)
channel.registerObject("bitmaskApp", self.bridge)
self.page().setWebChannel(channel)
icon = QtGui.QIcon()
icon.addPixmap(
QtGui.QPixmap(":/mask-icon.png"),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.setWindowIcon(icon)
示例9: _stockInfoAct
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def _stockInfoAct(self):
code, name = self._interface.getCodeName()
if code is None: return
browser = DyWebView()
url = 'http://basic.10jqka.com.cn/32/{0}/'.format(code[:-3])
browser.load(QUrl(url))
browser.setWindowTitle(name)
rect = QApplication.desktop().availableGeometry()
taskBarHeight = QApplication.desktop().height() - rect.height()
browser.resize(rect.width()//3 * 2, rect.height() - taskBarHeight)
browser.move((rect.width() - browser.width())//2, 0)
browser.show()
self._browsers.append(browser)
示例10: __init__
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.DomainCookies = {}
self.setWindowTitle('微信读书助手') # 设置窗口标题
self.resize(900, 600) # 设置窗口大小
self.setWindowFlags(Qt.WindowMinimizeButtonHint) # 禁止最大化按钮
self.setFixedSize(self.width(), self.height()) # 禁止调整窗口大小
url = 'https://weread.qq.com/#login' # 目标地址
self.browser = QWebEngineView() # 实例化浏览器对象
self.profile = QWebEngineProfile.defaultProfile()
self.profile.cookieStore().deleteAllCookies() # 初次运行软件时删除所有cookies
self.profile.cookieStore().cookieAdded.connect(self.onCookieAdd) # cookies增加时触发self.onCookieAdd()函数
self.browser.loadFinished.connect(self.onLoadFinished) # 网页加载完毕时触发self.onLoadFinished()函数
self.browser.load(QUrl(url)) # 加载网页
self.setCentralWidget(self.browser) # 设置中心窗口
# 网页加载完毕事件
示例11: setupUi
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(563, 339)
self.widget = QWebEngineView(Dialog)
self.widget.setGeometry(QtCore.QRect(10, 60, 531, 251))
self.widget.setObjectName("widget")
self.pushButtonGo = QtWidgets.QPushButton(Dialog)
self.pushButtonGo.setGeometry(QtCore.QRect(450, 20, 91, 23))
font = QtGui.QFont()
font.setPointSize(12)
self.pushButtonGo.setFont(font)
self.pushButtonGo.setObjectName("pushButtonGo")
self.lineEditURL = QtWidgets.QLineEdit(Dialog)
self.lineEditURL.setGeometry(QtCore.QRect(100, 20, 331, 21))
font = QtGui.QFont()
font.setPointSize(12)
self.lineEditURL.setFont(font)
self.lineEditURL.setObjectName("lineEditURL")
self.label = QtWidgets.QLabel(Dialog)
self.label.setGeometry(QtCore.QRect(10, 20, 71, 16))
font = QtGui.QFont()
font.setPointSize(12)
self.label.setFont(font)
self.label.setObjectName("label")
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
示例12: init_gui
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def init_gui(application, port=0, width=800, height=600,
window_title="PyFladesk", icon="appicon.png", argv=None):
if argv is None:
argv = sys.argv
if port == 0:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('localhost', 0))
port = sock.getsockname()[1]
sock.close()
# Application Level
qtapp = QtWidgets.QApplication(argv)
webapp = ApplicationThread(application, port)
webapp.start()
qtapp.aboutToQuit.connect(webapp.terminate)
# Main Window Level
window = QtWidgets.QMainWindow()
window.resize(width, height)
window.setWindowTitle(window_title)
window.setWindowIcon(QtGui.QIcon(icon))
# WebView Level
webView = QtWebEngineWidgets.QWebEngineView(window)
window.setCentralWidget(webView)
# WebPage Level
page = WebPage('http://localhost:{}'.format(port))
page.home()
webView.setPage(page)
window.show()
return qtapp.exec_()
示例13: add_tab
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def add_tab(self, *args):
webview = qtwe.QWebEngineView()
tab_index = self.tabs.addTab(webview, 'New Tab')
webview.urlChanged.connect(
lambda x: self.tabs.setTabText(tab_index, x.toString()))
webview.urlChanged.connect(
lambda x: self.urlbar.setText(x.toString()))
# make it so pop-up windows call this method
webview.createWindow = self.add_tab
# History
webview.urlChanged.connect(self.update_history)
# Profile
page = qtwe.QWebEnginePage(self.profile)
webview.setPage(page)
# Add the finder script
page.scripts().insert(self.finder_script)
# set default content
webview.setHtml(
'<h1>Blank Tab</h1><p>It is a blank tab!</p>',
qtc.QUrl('about:blank'))
return webview
示例14: __init__
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.resize(1280, 720)
self.browser = QWebEngineView()
self.setCentralWidget(self.browser)
示例15: python_to_js
# 需要导入模块: from PyQt5 import QtWebEngineWidgets [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
def python_to_js(page_or_tab, name, *args):
page = page_or_tab.page() if isinstance(page_or_tab, QWebEngineView) else page_or_tab
page.runJavaScript('window.send_message_to_javascript(%s, %s)' % (json.dumps(name), json.dumps(args)), QWebEngineScript.ApplicationWorld)