How to create a hyperlink with a Label in Tkinter?

TkinterServer Side ProgrammingProgramming

Tkinter Label widgets are generally used to display text or images. In this example, we will see how to add a hyperlink on a Label widget in an application.

In order to add a hyperlink, we can bind the label text with a button that makes it clickable. The open_new(url) method is used to define the function that opens a web browser to follow the link. The open_new(url) method is defined in the webbrowser module in Python which can be imported in the notebook using 'import webbrowser'.


#Import the required libraries
from tkinter import *
import webbrowser

#Create an instance of tkinter frame
win = Tk()

#Define a callback function
def callback(url):

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



Running the above code will display a Label text with a URL.

The displayed window will show a hyperlink which upon clicking will redirect the user to the website:

Published on 15-Apr-2021 14:21:51