Pyqt5 simple use of loading web pages

Source: Internet
Author: User

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

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 (' ')) ()    defload (self, URL): Self.webview.load (Qurl (URL)) ()if __name__=='__main__': App=qapplication (SYS.ARGV) screen=Form () ()URL =""screen.load (URL) sys.exit (app.exec_ ())

Pyqt5 simple use of loading web pages

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.