URL Opening Application Using Python

URL Opening Application Using Python

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


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.

assignment advertisement

We will understand the program using comments as usual.


# importing webbrowser module
import webbrowser
# importing tkinter
from tkinter import *

# creating root
root = Tk()
# setting GUI title
# setting GUI geometry

# function to open copyassignment.com in browser
def copyassignment():

# function to open google in browser
def google():

# 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)

If you will click on the buttons the corresponding URL will get open automatically in your browser.

Avatar of Harry

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at [email protected] Thank you

1 thought on “URL Opening Application Using Python

Comments are closed.