Web-browser redirect using tkinter

 Code for web-browser link redirect.

Here i am using tkinter module, To install tkinter  go to your command prompt and type pip install tkinter

then run this program on your IDE.

# importing tkinter
from tkinter import *

# creating root
root = Tk()
# setting GUI title
root.title("WebBrowser")
# setting GUI geometry
root.geometry("400x400")


# function to open instagram profile in browser
def instagram():
webbrowser.open("www.instagram.com/")


# function to open google in browser
def google():
webbrowser.open("www.google.com")


# button to call instagram function
instagram = Button(root, text="visit instagram", command=instagram).pack(pady=20)
# button to call google function
google = Button(root, text="to google", command=google).pack(pady=20)

root.mainloop()

if this gives an error let me know in comment section.

For query contact me 

Follow me on instagram🔗

Comments

Post a Comment