The following preliminary use of the PYQT5, constructs a webview to load the URL, renders the Web page.
1. Install the PYQT5 package, you can use the Douban source
Install pyqt5-i http://pypi.douban.com/simple--trusted-host pypi.douban.com
2. The code below
#!/usr/bin/python#-*-coding:utf-8-*-ImportSYS fromPyqt5.qtcoreImport* fromPyqt5.qtwidgetsImport* fromPyqt5.qtwebkitwidgetsImport*classForm (qwidget):def __init__(Self, parent=None): Super (Form, self).__init__(parent)#self.setwindowopacity (1) #self.setwindowflags (qt.framelesswindowhint) #Self.setattribute (Qt.wa_translucentbackground) #Self.showfullscreen ()Rect =qapplication.desktop (). Screengeometry () self.resize (Rect.width (), Rect.height ()) Self.setwindowflags (Qt . Framelesswindowhint|qt.windowstaysontophint) Self.webview=Qwebview ()VBox=qvboxlayout () vbox.addwidget (self.webview) main=qgridlayout ()main.setspacing (0) main.addlayout (vbox, 0, 0) self.setlayout (main)#self.setwindowtitle ("Codatahd") #webview.load (Qurl (' http://www.cnblogs.com/misoag/archive/2013/01/09/2853515.html ')) #webview.show () defload (self, URL): Self.webview.load (Qurl (URL)) self.webview.show ()if __name__=='__main__': App=qapplication (SYS.ARGV) screen=Form () screen.show ()URL ="https://www.baidu.com"screen.load (URL) sys.exit (app.exec_ ())
Pyqt5 simple use of loading web pages