0% found this document useful (0 votes)
96 views

Web Browser Using Python

This document describes developing a basic web browser using Python, PYQT Framework, and QT Designer. The UI is created using QT Designer and saved as a .ui file. Logic is then added to the UI using Python code to load URLs from a line edit input when return is pressed and display them in a QWebView. The browser allows accessing websites but URLs must be entered manually and it has limitations like some fonts, videos, and JavaScript may not work properly.

Uploaded by

Shyam Bhatiya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views

Web Browser Using Python

This document describes developing a basic web browser using Python, PYQT Framework, and QT Designer. The UI is created using QT Designer and saved as a .ui file. Logic is then added to the UI using Python code to load URLs from a line edit input when return is pressed and display them in a QWebView. The browser allows accessing websites but URLs must be entered manually and it has limitations like some fonts, videos, and JavaScript may not work properly.

Uploaded by

Shyam Bhatiya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Web Browser Using Python

Submitted By-
Chatanya Mahajan(1031310688)
Tithi Nikhita(1031310730)
Saikat Sinha(1031310709)
Department of Computer Science Engineering
SRM University, Kattankulathur
April 2015
ABSTRACT
• Web browser is the most commonly
used client application and speed
and efficiency of our online work
depends on browser to a great
extent. As the market is flooding
with new browsers there is a lot of
confusion in everyone’s mind as to
which is the best browser. Our
project aims to answer this question.
INTRODUCTION
• The World Wide Web has come a long
way in its short existence. Without it,
many people wouldn’t know what to
do with their day. And others literally
couldn’t survive without it. To browse
the internet we use browser. A
browser provides a user interface for
displaying and selecting items from a
list of data or from hierarchically
organized lists of data such as
WHY ARE WEB BROWSERS SO
IMPORTANT?
• Today most of what we use the web
for isn’t just web pages, they are
applications. Users upload download
videos, chat, play online games, and
use many other web services.
• Web browser is becoming more and
more important as an application
used to conduct billions of dollars of
Internet-enabled commerce each
year.
Tools/Software used
• Python Programming Language
Python is a widely used general-
purpose, high-level programming
language. Its design philosophy
emphasizes code readability, and its
syntax allows programmers to
express concepts in fewer lines of
code than would be possible in
languages such as C++ or Java.
Tools/Software used
• PYQT Framework
PyQt is one of the two most popular Python
bindings for the Qt cross-platform
GUI/XML/SQL C++ framework (another
binding is PySide). PyQt developed by
Riverbank Computing Limited. Qt itself is
developed as part of the Qt Project. PyQt
provides bindings for Qt 4 and Qt 5. PyQt is
distributed under a choice of licences: GPL
version 2, GPL version 3, or a commercial
license.
Tools/Software used
• QT Designer
Qt Designer is the Qt tool for designing and
building graphical user interfaces. It allows
you to design widgets, dialogs or complete
main windows using on-screen forms and a
simple drag-and-drop interface. It has the
ability to preview your designs to ensure
they work as you intended, and to allow you
to prototype them with your users, before
you have to write any code.
Steps Followed while developing the WEB
BROWSER

• Installing the required


packages/Softwares

1.Python
2.PYQT for Python
3.QT Designer
Steps Followed while developing the WEB
BROWSER

• Creating UI with QT Designer


1. Select Main Window and press
Create. We now have our designer
window open. 
2. Drag a KWebViewcomponent on the
window.
3. We also add an Line Edit on top.
Press File > Save As > browser.ui. 
Steps Followed while developing the WEB
BROWSER
Steps Followed while developing the WEB
BROWSER

• Creating the logic


Create a file called run.py with this contents:
• import sys
• from browser import BrowserDialog
• from PyQt4 import QtCore, QtGui
• from PyQt4.QtCore import QUrl
• from PyQt4.QtWebKit import QWebView
• 
• class MyBrowser(QtGui.QDialog):
•     def __init__(self, parent=None):
•         QtGui.QWidget.__init__(self, parent)
•         QWebView.__init__(self)
•         self.ui = BrowserDialog()
•         self.ui.setupUi(self)
•         self.ui.lineEdit.returnPressed.connect(self.loadURL)

•     def loadURL(self):
•         url = self.ui.lineEdit.text()
•         self.ui.qwebview.load(QUrl(url))
•         self.show()  
•         #self.ui.lineEdit.setText("")
• 
• if __name__ == "__main__":
•     app = QtGui.QApplication(sys.argv)
•     myapp = MyBrowser()
•     myapp.ui.qwebview.load(QUrl('http://www.talkera.org/python'))
•     myapp.show()
•     sys.exit(app.exec_())
Steps Followed while developing the WEB
BROWSER

• This code will use the UI as defined in


browser.py and add logic to it. The
lines
self.ui.lineEdit.returnPressed.connect(self.loadURL)
def loadURL(self):
  url = self.ui.lineEdit.text()
        self.ui.qwebview.load(QUrl(url))
        self.show()  
       #self.ui.lineEdit.setText("")
OUTPUT

• Making sure we type the full url, e.g.  : http://python.org including


the http:// part.  The browser should now start:
Drawbacks

• Javascript files will not be executed


• Videos working with HTML5 and Flash
will not work
• Fonts may not function properly
sometimes.
SUMMARY

Web browsers allows a user to quickly and easily


access information provided on many web pages
at many web sites by traversing these links. A
browser provides a user interface for displaying
and selecting items from a list of data or from
hierarchically organized lists of data such as
directory paths. We can tell that browser is the
most commonly used client side application.
SUMMARY
A web browser is client side application program that
contacts remote servers and retrieves documents from
it and displays them on screen, either within the
browser window itself or by passing the document to an
external helper application. We have developed our
own browser using python, PYQT Framework and QT
Designer. We created a browser.ui file by following
some simple steps and then we executed a run.py
program in python. This Web browser can be used to
access any website using their URL. But the URLs has
to be entered manually. It has few drawbacks such as
various fonts, few video formats and Javascript files
may not function properly.
REFERENCE
• http://en.wikipedia.org/wiki/Python_%28progra
mming_language%29
• https://pythonspot.com/creating-a-webbrowser-wit
h-python-and-pyqt-tutorial/
• PYQT 5 Reference Guide
• http://pyqt.sourceforge.net/Docs/PyQt4/designer.h
tml
• http://doc.qt.io/qt-4.8/designer-manual.html
• http://python.org
• Python Programming: An Introduction to
Computer Science, 2nd Ed.
• https://wiki.python.org/moin/PyQt

You might also like