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


Python QWebEngineView.setGeometry方法代码示例

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


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

示例1: Ui_MainWindow

# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setGeometry [as 别名]
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.qwebengine = QWebEngineView(self.centralwidget)
        self.qwebengine.setGeometry(QtCore.QRect(10, 30, 451, 321))
        self.qwebengine.setAutoFillBackground(False)
        self.qwebengine.setStyleSheet("background-color: rgb(170, 170, 127);")
        self.qwebengine.setObjectName("qwebengine")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 23))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
开发者ID:kiorry,项目名称:PYQT,代码行数:28,代码来源:Ui_plotly_pyqt.py

示例2: Window

# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import setGeometry [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


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