Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Python makes a simple browser


Jun 01, 2021 Article blog



This article was reproduced to Know ID: Charles (Bai Lu) knows his personal column

Download the W3Cschool Mobile App, 0 Foundation Anytime, Anywhere Learning Programming >> Poke this to learn

Lead

I saw someone do it a long time ago...

Today's tide of hard work...

Just want to try it yourself.

That's all.

The PyQt version used is 5.10.

Online Chinese tutorial on PyQt5.10.

So the final effect is general (after all, for a short period of time can not nibble on the official all-English tutorial).

So,

don't get your hopes up...


Related documents

Baidu web download link: https://pan.baidu.com/s/1V95QG5PZCigx86S8hgf5Rg

Password: si8r


The main idea

Key implemented features:

(1) can display the web page normally;

(2) set up the navigation bar, in order to achieve the browser forward, backward, stop loading and refresh function;

(3) set the address bar, you can update the URL of the current page in real time, while supporting the input address carriage return access function;

(4) Set tabs, you can double-click the navigation bar to open a new tab, thus supporting simultaneous access to multiple pages.

How features such as the underlying transport protocol are implemented:

QtWebEngine module with PyQt5.

The implementation process can be found in the source code (with more detailed comments).


deficiencies

Initial tests do not have bugs, but sometimes there are catons...

Interested parties can optimize themselves...

Welcome backstage communication (T_T if you don't think I'm a half-day old white man who just entered the pit)...

Welcome to propose amendments in the background...

If necessary, I can water another article like "Python Makes Easy Browser (Subsequent Optimization)" hhhhh...


Develop tools

Python version: 3.5.4

Related modules:

The PyQt5 module (version 5.10) and some Python modules come with it.

Environment construction

Install Python and add it to the environment variable, and pip installs the relevant modules that are required.

Use the demo

Run the Create_Browser.py file in the cmd window.

As shown in the following image:

 Python makes a simple browser1


more

The PyQt5 Quick Start document has been shared in the menu bar at the bottom of this public number for those in need.

The documentation mainly refers to some blog posted versions on CSDN that are available for pro-test PyQt 5.10.

There will be time in the future to organize the PyQt 5.10 version of the full use of the documentation.