

{"id":99421,"date":"2021-07-26T09:00:15","date_gmt":"2021-07-26T03:30:15","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=99421"},"modified":"2026-06-01T13:52:56","modified_gmt":"2026-06-01T08:22:56","slug":"create-web-browser-python-pyqt","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/","title":{"rendered":"Create a Web Browser in Python with PyQT"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:2576,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1Fhl9FFedWoNcirXFEyEYw1fxpsD32oq1\\\/view?usp=drive_link&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20260601082330\\\/https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1Fhl9FFedWoNcirXFEyEYw1fxpsD32oq1\\\/view?usp=drive_link&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-06-02 00:54:03&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-07 08:28:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-10 09:46:34&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-10 09:46:34&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p>Browser is application software that helps in accessing the World Wide Web. The devices used by us such as laptops, tablets, smartphones all contain web browsers. The most used web browser is Google Chrome. How about creating our own web browser? It will be fun to create our own web browser. Let\u2019s start creating this fun project.<\/p>\n<h3>About web browser<\/h3>\n<p>In this project, we will be creating a web browser that will use Google as its search engine. The web browser fetches the information from the web. The user sees the fetched information.<\/p>\n<h3>Python web browser project<\/h3>\n<p>The purpose of this project is to create our own web browser. Install PyQt5, PyQt5WebEngineWidgets to start the project.<\/p>\n<h3>Project Prerequisites<\/h3>\n<p>Basic knowledge of PyQt5 and PyQt5WebEngineWidgets is required to start the project. Furthermore, knowledge of functions and classes in python is also a must for this project.<\/p>\n<h3>Download Python Web Browser Source Code<\/h3>\n<p>You can download python source code for python web browser from the following link: <a href=\"https:\/\/drive.google.com\/file\/d\/1Fhl9FFedWoNcirXFEyEYw1fxpsD32oq1\/view?usp=drive_link\"><strong>Python Web Browser Project Code<\/strong><\/a><\/p>\n<h3>Project File Structure<\/h3>\n<p>Steps to develop web browser project using Python:<\/p>\n<p>1. Installing PyQt5 and PyQt5WebEngineWidgets<br \/>\n2. Importing modules<br \/>\n3. Creating a class<br \/>\n4. Creating various buttons on the top of the window<\/p>\n<h4>1. Installing PyQt5 and PyQt5WebEngineWidgets :<\/h4>\n<p>Before starting this project you need to install PyQt5 and PyQt5WebEngineWidgets. PyQt5 is a module which helps in building Graphical User Interface apps in python. To install it on the system, write the following command on command prompt or terminal window.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">pip install PyQt5\r\npip install PyQt5WebEngineWidgets\r\n<\/pre>\n<h4>2. Importing modules:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># importing modules for python web browser project\r\nimport sys\r\nfrom PyQt5.QtCore import *\r\nfrom PyQt5.QtWidgets import *\r\nfrom PyQt5.QtWebEngineWidgets import *\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p><strong>a. sys :<\/strong> Different parts of the runtime module are manipulated with this module. It provides various functions and variables to do this.<br \/>\n<strong>b. PyQt5:<\/strong> It is a module which helps in building Graphical User Interface modules in Python.<br \/>\n<strong>c. QtCore:<\/strong> This module contains Non-Graphical User Interface functionality.<br \/>\n<strong>d. Qtwidgets:<\/strong> User Interface is created in Qt with the help of them.<br \/>\n<strong>e. QtWebEngineWidgets:<\/strong> This framework embeds the web content in the application.<\/p>\n<h4>3. Creating a class<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">class MainScreen(QMainWindow):\r\n    def __init__(self):\r\n        super(MainScreen,self).__init__()\r\n        self.Browser = QWebEngineView()\r\n        self.Browser.setUrl(QUrl('https:\/\/google.com'))\r\n        self.setCentralWidget(self.Browser)\r\n        self.showMaximized()\r\n        NavBar=QToolBar()\r\n        self.addToolBar(NavBar)\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><br \/>\n<strong>a.<\/strong> <strong>QWebEngineView():<\/strong> Pointer to a web page object is returned.<br \/>\n<strong>b. setUrl():<\/strong> Url is set with the help of setUrl().<br \/>\n<strong>c. QUrl:This<\/strong> class provides a convenient interface to work in python.<br \/>\n<strong>d. setCentralWidget():<\/strong> The widget is set at the centre of the screen.<br \/>\n<strong>e. showMaximized():<\/strong> It is a way to open a window in maximized format.<br \/>\n<strong>f. QToolBar():<\/strong> It consists of buttons with icons, text buttons and it is a movable panel.<br \/>\n<strong>g. addToolBar():<\/strong> A toolbar is added to the window.<\/p>\n<h4>4. Creating various buttons at the top of the window:<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># creating various buttons\r\n        BackButton=QAction('Back',self)\r\n        BackButton.triggered.connect(self.Browser.back)\r\n        NavBar.addAction(BackButton)\r\n \r\n        ForwardButton = QAction('Forward',self)\r\n        ForwardButton.triggered.connect(self.Browser.forward)\r\n        NavBar.addAction(ForwardButton)\r\n \r\n        ReloadButton = QAction('Reload',self)\r\n        ReloadButton.triggered.connect(self.Browser.reload)\r\n \r\n        NavBar.addAction(ReloadButton)\r\n        HomeButton = QAction('Home',self)\r\n        HomeButton.triggered.connect(self.NavigateHome)\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>BackButton, NavBar, HomeButton, Reload Button are the names of variables.<br \/>\n<strong>a. QAction():<\/strong> Each command is represented as an action with the help of QAction.<br \/>\n<strong>b. triggered<\/strong> : For instance: if the Home button is clicked it will connect it to the NavigateHome. It means that if we click the button it will be triggered to perform some action.<br \/>\n<strong>c. connect():<\/strong> For instance: if we click ReloadButton it will connect it to the browser. Basically, it is used to connect.<br \/>\n<strong>d. addAction():<\/strong> For adding any action this method is used.<\/p>\n<h4>5. Remaining code :<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">self.UrlBar=QLineEdit()\r\n        self.UrlBar.returnPressed.connect(self.NavigateToUrl)\r\n \r\n        NavBar.addWidget(self.UrlBar)\r\n        self.Browser.urlChanged.connect(self.UpdateUrl)\r\n \r\n    def NavigateHome(self):\r\n        self.Browser.setUrl(\"http:\/\/google.com\")\r\n \r\n    def NavigateToUrl(self):\r\n        Url = self.UrlBar.text()\r\n        self.Browser.setUrl(QUrl('https:\/\/google.com'))\r\n        \r\n    def UpdateUrl(self,p):\r\n        self.UrlBar.setText(str(p))\r\n \r\nApplication = QApplication(sys.argv)\r\nQApplication.setApplicationName('web browser by- DataFlair')\r\nWindow = MainScreen()\r\nApplication.exec()\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p><strong>a. QLineEdit():<\/strong> Keyboard input is received with this widget.<br \/>\n<strong>b. text():<\/strong> It is used to get the value.<br \/>\n<strong>c. urlChanged:<\/strong> If the url is changed, urlChanged is used.<br \/>\n<strong>d. setText:<\/strong> The value of the textbox is set with this widget.<br \/>\n<strong>e. QApplication:This<\/strong> class manages main settings and Graphical User Interface control flow.<br \/>\n<strong>f. setApplicationName():<\/strong> Title of the main window is set by this widget.<br \/>\n<strong>g. exec():<\/strong> Execution of the QApplication object in the event loop is done with exec().<\/p>\n<h4>Python Web Browser Output:<\/h4>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-web-browser-output-.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-99434\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-web-browser-output-.png\" alt=\"python web browser output\" width=\"1920\" height=\"1027\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-web-browser-output-.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-web-browser-output--768x411.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-web-browser-output--1536x822.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-web-browser-output--720x385.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-web-browser-output--520x278.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-web-browser-output--320x171.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h3>Summary:<\/h3>\n<p>We have successfully developed our own web browser using the two Python modules PyQt5 and PyQt5WebEngineWidgets. We have used classes and functions in this How to make a Web Browser project.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Browser is application software that helps in accessing the World Wide Web. The devices used by us such as laptops, tablets, smartphones all contain web browsers. The most used web browser is Google Chrome.&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":99435,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[24833,21082,24834],"class_list":["post-99421","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-create-web-browser-python","tag-python-project","tag-web-browser-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Create a Web Browser in Python with PyQT - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn How to create a Web Browser using Python and PyQt5 module. we can use this simple web browser to visit different websites\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create a Web Browser in Python with PyQT - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn How to create a Web Browser using Python and PyQt5 module. we can use this simple web browser to visit different websites\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-26T03:30:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-01T08:22:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-project-create-web-browser.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create a Web Browser in Python with PyQT - DataFlair","description":"Learn How to create a Web Browser using Python and PyQt5 module. we can use this simple web browser to visit different websites","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/","og_locale":"en_US","og_type":"article","og_title":"Create a Web Browser in Python with PyQT - DataFlair","og_description":"Learn How to create a Web Browser using Python and PyQt5 module. we can use this simple web browser to visit different websites","og_url":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-07-26T03:30:15+00:00","article_modified_time":"2026-06-01T08:22:56+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-project-create-web-browser.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Create a Web Browser in Python with PyQT","datePublished":"2021-07-26T03:30:15+00:00","dateModified":"2026-06-01T08:22:56+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/"},"wordCount":640,"commentCount":7,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-project-create-web-browser.jpg","keywords":["create web browser python","Python project","web browser python"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/","url":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/","name":"Create a Web Browser in Python with PyQT - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-project-create-web-browser.jpg","datePublished":"2021-07-26T03:30:15+00:00","dateModified":"2026-06-01T08:22:56+00:00","description":"Learn How to create a Web Browser using Python and PyQt5 module. we can use this simple web browser to visit different websites","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-project-create-web-browser.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-project-create-web-browser.jpg","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/create-web-browser-python-pyqt\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Create a Web Browser in Python with PyQT"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/99421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=99421"}],"version-history":[{"count":5,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/99421\/revisions"}],"predecessor-version":[{"id":148658,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/99421\/revisions\/148658"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/99435"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=99421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=99421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=99421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}