How to open Website with python?

kavehsabouri

Kaveh Sabouri

Posted on October 14, 2022

How to open Website with python?

Hello everyone today we want open website with python.

from tkinter import *
import customtkinter
import webbrowser

def open_web():
    new = 1
    url = ent.get()

    webbrowser.open(url,new=new)

window = Tk()
window.geometry("1430x745")
window.title("Web browser")
window.resizable(False,False)
window.config(bg="#F4F1DE")

bg = "#F4F1DE"


ent = customtkinter.CTkEntry(window,corner_radius=6,placeholder_text="Enter The url of the Web",width=500,height=50)
ent.place(x=440,y=300)

btn = customtkinter.CTkButton(window,text="Browse",width=100,height=40,fg_color="#81B29A",hover_color="#97B6A7",command=open_web)
btn.place(x=950,y=303)

window.mainloop()
Enter fullscreen mode Exit fullscreen mode

This application has been tested on Mac, and its appearance may change in Windows or Linux.

output:

Image description

💖 💪 🙅 🚩
kavehsabouri
Kaveh Sabouri

Posted on October 14, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related