Submitted by : Shashank Dharasurkar
Programming Tutorials: Python
Posted on : 2019-09-04
Hello guys, today we are going to create a simple web browser using python and other gui supported libraries available in python so lets start.
For making simple single tabbed web browser we need PySide library installed in your machine. So if its installed then start with coding or if its not installed just install it via pip command as shown below
pip install pyside or pip3 install pyside
(Note: You should know that python version 3.x uses pip3 instead of pip)
After entering above command on terminal pyside will get installed on your machine. After installation completed lets start with coding.
import sys from PySide.QtCore import * from PySide.QtGui import * from PySide.QtWebKit import * app = QApplication(sys.argv) web = QWebView() web.load(QUrl("http://gmail.com")) web.show()
Just copy the above code and paste it with name browser.py or simply type code on terminal. After saving the browser.py file open command prompt and navigate to the folder you just saved .py file and simply enter the command as given below.
After executing above file a new window will popup like this. If you have stable internet connection it will open the desired website quickly otherwise it will take time. Here I am passing www.gmail.com as default url so it will open Gmail’s Home page like this.
So, try it with yourself and if any error or problem appears feel free to comment in comment section we will try to solve your problem as soon as possible.
Thank You. Happy coding..