Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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()
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #How #create #hyperlink #Label #Tkinter
ADD COMMENT
Topic
Name
2+9 =