Advertisement
here2share

# Tk_hyperlink_via_Label.py

Jul 18th, 2016
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. # Tk_hyperlink_via_Label.py
  2. import Tkinter as tk
  3. import webbrowser
  4.  
  5. def callback(event):
  6.     webbrowser.open_new(event.widget.cget("text"))
  7.  
  8. root = tk.Tk()
  9. lbl = tk.Label(root, text=r"http://www.google.com", fg="blue", cursor="hand2")
  10. lbl.pack()
  11. lbl.bind("<Button-1>", callback)
  12. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement