Answers for "How to create a hyperlink with a Label in Tkinter"

0

How to create a hyperlink with a Label in Tkinter

#Import the required libraries
from tkinter import *
import webbrowser

#Create an instance of tkinter frame
win = Tk()
win.geometry("750x250")

#Define a callback function
def callback(url):
   webbrowser.open_new_tab(url)

#Create a Label to display the link
link = Label(win, text="www.tutorialspoint.com",font=('Helveticabold', 15), fg="blue", cursor="hand2")
link.pack()
link.bind("<Button-1>", lambda e:callback("http://www.tutorialspoint.com"))

win.mainloop()
Posted by: Guest on April-30-2022

Code answers related to "How to create a hyperlink with a Label in Tkinter"

Python Answers by Framework

Browse Popular Code Answers by Language