当前位置: 首页>>代码示例>>Python>>正文


Python QWebEngineView.setWindowTitle方法代码示例

本文整理汇总了Python中PyQt5.QtWebEngineWidgets.QWebEngineView.setWindowTitle方法的典型用法代码示例。如果您正苦于以下问题:Python QWebEngineView.setWindowTitle方法的具体用法?Python QWebEngineView.setWindowTitle怎么用?Python QWebEngineView.setWindowTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWebEngineWidgets.QWebEngineView的用法示例。


在下文中一共展示了QWebEngineView.setWindowTitle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Window

# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setWindowTitle [as 别名]
class Window(BaseWindow):
    def __init__(self):
        self.debug=1
        self.app = QApplication(sys.argv)
        self.desktop= QApplication.desktop()
        self.web = QWebEngineView()
        self.icon = QIcon(ICON)
        #self.web.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
      
        self.web.titleChanged.connect(self.title_changed)
        self.web.iconUrlChanged.connect(self.icon_changed)
        self.web.page().windowCloseRequested.connect(self.close_window)
        self.web.page().geometryChangeRequested.connect(self.set_geometry)
    
    def show(self,window_state):
        if window_state == "maximized" and not self.web.isMaximized():
            self.web.showNormal()
            self.web.showMaximized()
        elif window_state == "fullscreen" and not self.web.isFullScreen():
            self.web.showNormal()
            self.web.showFullScreen()
        elif window_state == "normal":
            self.web.showNormal()
        else:
            self.web.show()

    def run(self):
        return self.app.exec_()
                
    def set_debug(self, debuglevel):
        self.debug=debuglevel
    
    def set_geometry(self,geom ):
        self.web.setGeometry(geom)
        
    def close_window(self):
        sys.exit()
    
    def icon_changed(self):
        if not self.icon.isNull():
            self.web.setWindowIcon(self.icon)
            
    def title_changed(self, title):
        self.web.setWindowTitle(title)

    def load_url(self,url):
        self.url=QUrl.fromEncoded(url)
        self.web.setUrl(self.url)
    
    def set_size(self,width, height):
        if width<=0:
            width=640
        if height<=0:
            height=480
        
        left=(self.desktop.width()-width)/2
        top=(self.desktop.height()-height)/2
        
        self.web.setGeometry(left,top,width,height)
开发者ID:cris-b,项目名称:oma-welcome,代码行数:61,代码来源:qt5.py

示例2: QApplication

# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setWindowTitle [as 别名]
from PyQt5.QtOpenGL import QGLWidget
import plots

html = '''<html>
<head>
    <title>Plotly Example</title>
    <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
    <body>
    %(plot_content)s
    </body>
</html>'''

if __name__ == '__main__':

    app = QApplication(sys.argv)


    w = QWebView()
    w.resize(800, 600)
    w.setWindowTitle('Simple Plot')

    # QWebSettings.globalSettings().setAttribute(QWebSettings.AcceleratedCompositingEnabled, True)
    # QWebSettings.globalSettings().setAttribute(QWebSettings.WebGLEnabled, True)

    plot_content = plots.plot3d()
    w.setHtml(html%{'plot_content':plot_content})
    w.show()

    sys.exit(app.exec_())
开发者ID:ricleal,项目名称:PythonCode,代码行数:32,代码来源:test_plot3d.py

示例3: QWebEngineView

# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setWindowTitle [as 别名]
import os
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.Qt import QUrl
from PyQt5 import QtWidgets, QtGui

widget = QWebEngineView()
fake_url = QUrl.fromLocalFile(os.path.abspath("seamless.html"))
widget.setWindowTitle(PINS.title.get().data)
reloadAction = QtWidgets.QAction(QtGui.QIcon('exit.png'), '&Reload', widget)
reloadAction.setShortcut('F5')
reloadAction.setStatusTip('Reload')
reloadAction.triggered.connect(widget.reload)
widget.addAction(reloadAction)
widget.setHtml(PINS.val.get().data, fake_url)
widget.show()
开发者ID:sjdv1982,项目名称:seamless,代码行数:17,代码来源:cell-browser.py


注:本文中的PyQt5.QtWebEngineWidgets.QWebEngineView.setWindowTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。