Advertisement
here2share

# Tk_mouseover.py

Oct 8th, 2019
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. # Tk_mouseover.py
  2.  
  3. from Tkinter import *
  4.  
  5. root = Tk()
  6. Canvas(root, height=40, width=180).grid()
  7.  
  8. def Submit(event):
  9.     print event
  10.  
  11. entry1 = Entry(root)
  12. entry2 = Entry(root)
  13.  
  14. sp = ' '*10
  15. btn1 = Label(root, text='Hover Over Me', bg='green')
  16. btn1.bind('<Enter>', lambda e: Submit('Mouse Hovered!'))
  17. btn2 = Label(root, text=sp+'Click Me'+sp, bg='orange')
  18. btn2.bind('<Button-1>', lambda e: Submit('Button Clicked!'))
  19.  
  20. quit = Button(root, text='Quit', command=root.destroy, bg='grey')
  21.  
  22. title = Label(root, text='Tk Mouseover')
  23. title.grid(row=0, columnspan=2)
  24. btn1.grid(row=1, column=0, sticky=W+E)
  25. btn2.grid(row=1, column=1, sticky=W+E)
  26. quit.grid(row=2, column=1, sticky=W+E)
  27.  
  28. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement