This repository was archived by the owner on Aug 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtkinter_bindings.py
More file actions
27 lines (21 loc) · 1.52 KB
/
tkinter_bindings.py
File metadata and controls
27 lines (21 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from tkinter import *
window = Tk()
window.geometry("300x200")
L = Label(text="Nothing")
L.pack(fill="both", expand=True)
window.bind("<Button-1>", lambda ev: L.config(text="Button 1 - Mouse Left Key Down"))
window.bind("<Button-2>", lambda ev: L.config(text="Button 2 - Mouse Wheel Click"))
window.bind("<Button-3>", lambda ev: L.config(text="Button 3 - Mouse Right Key Down"))
window.bind("<Button-4>", lambda ev: L.config(text="Button 4 - Mouse Wheel Up"))
window.bind("<Button-5>", lambda ev: L.config(text="Button 5 - Mouse Wheel Down"))
window.bind("<Double-Button-1>", lambda ev: L.config(text="Double Button 1 - Mouse Left Key Down"))
window.bind("<Double-Button-2>", lambda ev: L.config(text="Double Button 2 - Mouse Wheel Click"))
window.bind("<Double-Button-3>", lambda ev: L.config(text="Double Button 3 - Mouse Right Key Down"))
window.bind("<Double-Button-4>", lambda ev: L.config(text="Double Button 4 - Mouse Wheel Up"))
window.bind("<Double-Button-5>", lambda ev: L.config(text="Double Button 5 - Mouse Wheel Down"))
window.bind("<ButtonRelease-1>", lambda ev: L.config(text="Button Release 1 - Mouse Left Key Down"))
window.bind("<ButtonRelease-2>", lambda ev: L.config(text="Button Release 2 - Mouse Wheel Click"))
window.bind("<ButtonRelease-3>", lambda ev: L.config(text="Button Release 3 - Mouse Right Key Down"))
window.bind("<ButtonRelease-4>", lambda ev: L.config(text="Button Release 4 - Mouse Wheel Up"))
window.bind("<ButtonRelease-5>", lambda ev: L.config(text="Button Release 5 - Mouse Wheel Down"))
window.mainloop()