Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_hyperlink_via_Label.py
- import Tkinter as tk
- import webbrowser
- def callback(event):
- webbrowser.open_new(event.widget.cget("text"))
- root = tk.Tk()
- lbl = tk.Label(root, text=r"http://www.google.com", fg="blue", cursor="hand2")
- lbl.pack()
- lbl.bind("<Button-1>", callback)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement