
Python provides a module "webbrowser" to open any url.
To open any URL using this module, we need to type the URL inside function after the webbrowser. See how
webbrowser.open("url")So, any URL we will type here will automatically be opened during the running of the program.
We have tried to make this simple program some interesting i.e. we have combined the program with the GUI library of Python i.e. tkinter.

We will understand the program using comments as usual.
Code
# importing webbrowser module
import webbrowser
# importing tkinter
from tkinter import *
# creating root
root = Tk()
# setting GUI title
root.title("WebBrowser")
# setting GUI geometry
root.geometry("300x200")
# function to open violet-cat-415996.hostingersite.com in browser
def copyassignment():
webbrowser.open("www.violet-cat-415996.hostingersite.com")
# function to open google in browser
def google():
webbrowser.open("www.google.com")
# button to call copyassignment function
copyassignment = Button(root, text="visit copyassignment", command=copyassignment).pack(pady=20)
# button to call google function
mygoogle = Button(root, text="open Google", command=google).pack(pady=20)
root.mainloop()If you will click on the buttons the corresponding URL will get open automatically in your browser.



