Advertisement
here2share

# Tk_link_events.py

May 28th, 2018
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. # Tk_link_events.py
  2.  
  3. from Tkinter import *
  4.  
  5. def demo():
  6.     def click_link(event, text):
  7.         print("You clicked '%s'" % text)
  8.  
  9.     for text in ("link #1", "link #2", "link #3"):
  10.         link = Label(text=text, foreground="#0000ff")
  11.         link.bind("<1>", lambda event, text=text: click_link(event, text))
  12.         link.pack()
  13.  
  14. root = Tk()
  15. demo()
  16. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement