I want to make a Tkinter button respond to a left and right mouse click differently. How can I do this?
sneekula
969
Nearly a Posting Maven
Recommended Answers
Jump to PostBinding 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
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
sneekula
969
Nearly a Posting Maven
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.