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()
This application has been tested on Mac, and its appearance may change in Windows or Linux.
output:
Top comments (6)
Bonjour!
I'm impressed that you are interested in programming so young.
Just a trick: people who will read your article probably don't have python and a python editor opened right now. So the pythong script might not be enough for them to understand what you are doing.
The simple trick is to:
Hello
Thank you for commenting on my post. I am honored that you saw my post. I will definitely use your trick in my next article.
Sincerely, Kaveh Sabouri
You're welcome.
And actually you modify this article after it's posted, I do it all the time :)
Hello
I will be very happy to know your opinion about my post.
Well most importantly congrats for writing it.
I waited way too long before writing on my blog, you have a big head start on me.
The second thing is that you have something that works on your machine but probably doesn't on mine, either because I don't have the right version of python installed, or not the right editor, or I didn't install the dependencies, ...
So it's hard to look at your source code and understand what comes out of it. Therefore my suggestion to take a screnshot and include it.
Dear Jean-Michel Fayard
Thank you for helping me.
I am proud to be associated with you.
Sincerely, Kaveh Sabouri