I am trying to write a Tkinter code when a user types a name the URL appears:
I am trying to get the Label which is mySubmit to be clickable and to be opened in a new browser.
I have search several solutions but I didn't was not successful in getting it.
Here is the code:
root = Tk()
e = Entry(root, width=50)
e.pack(padx=50)
def open_url(mySubmit):
webbrowser.open_new(mySubmit)
mySubmit = Label(root, open_url)
def myClick(event=None):
global mySubmit
global reply
mySubmit["text"] = results()
if e.get() != "":
search.append(e.get())
# print(search)
e.delete(0,"end")
mySubmit.pack()
def open_url(mySubmit ):
pass #Open the url in a browser
root.bind('<Return>', myClick)
mySubmit.bind("<Button-1>", lambda e, url=mySubmit: open_url(mySubmit ))
My question is how to make mySubmit = Label(root)
clickable to open the url in the new browser