Home > Backend Development > Python Tutorial > An introduction to how to make a simple browser using pyqt5 in python3

An introduction to how to make a simple browser using pyqt5 in python3

黄舟
Release: 2017-10-19 10:54:36
Original
2534 people have browsed it

The following editor will bring you an example of using pyqt5 to create a super simple browser in python3. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.

We are using the QWebview module, and here we mainly show the usage of QWebview.

I spent a long time searching online to analyze the content of the web page, but it was not very clear.

This is the core code:


webview = Qwebview()
webview.load(Qurl('http://www.cnblogs.com/Blaxon/'))
webview.show()
Copy after login

The complete code (the code is Get other codes to change):


from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtWebKitWidgets import *


class Form(QWidget):
  def __init__(self, parent=None):
    super(Form, self).__init__(parent)

    tmp = QWebView()

    buttonLayout1 = QVBoxLayout()
    buttonLayout1.addWidget(tmp)

    mainLayout = QGridLayout()
    mainLayout.addLayout(buttonLayout1,)

    self.setLayout(mainLayout)
    self.setWindowTitle("Hello Qt")
    tmp.load(QUrl('http://www.cnblogs.com/misoag/archive/2013/01/09/2853515.html'))
    tmp.show()


if __name__ == '__main__':
  import sys
  app = QApplication(sys.argv)
  screen = Form()
  screen.show()
  sys.exit(app.exec_())
Copy after login

The above is the detailed content of An introduction to how to make a simple browser using pyqt5 in python3. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template