I want to make a Tkinter button respond to a left and right mouse click differently. How can I do this?
Jump to Post
Binding the mouse button to a particular function will do it ...
from Tkinter import * def left(event): root.title('clicked left') btn1.config(fg='blue') def right(event): root.title('clicked right') btn1.config(fg='red') root = Tk() root.title('click left or right on button') btn1 = Button(root, text=' Click on me ... ', width=40) btn1.pack() btn1.bind('<Button-1>', …
All 3 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.