In this article, we are going to see how we can open a website in the Tkinter window. We can open a website in Tkinter using webview. This library allows us to view the HTML content in its GUI window.
Syntax to install Tkinter and webview using the below commands.
pip install tk
pip install pywebview
Method 1: Using webview.create_window() and webview.start() function
In this method, we are use webview.create_window() and webview.start() function to open website in Tkinter. create_window() function is create window for website and start() function display this website on screen. Follow the below steps to open a website in Tkinter using this method.
- Import Tkinter and webview libraries.
- define an instance of Tkinter.
- Set the size of your window.
- Call webview.create_window() function.
Example:
Python3
from tkinter import *
import webview
tk = Tk()
tk.geometry( "800x450" )
webview.start()
|
Output:

Method 2: Using webbrowser.open() function
In this method. we use webbrowser.open() function. This function opens the requested page using the default browser. Follow the below steps to open a website in Tkinter using this method.
- Import Tkinter and webview libraries.
- define an instance of Tkinter.
- Set the size of your window.
- Call webbrowser.open() function.
Example:
Python3
import webbrowser
from tkinter import *
root = Tk()
root.title( "WebBrowsers" )
root.geometry( "660x660" )
webbrowser. open ( "www.instagram.com" )
|
Output:

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!