2
Contributors
1
Reply
3
Views
10 Years
Discussion Span
Last Post by vegaseat
0

You need to make this a GUI program ...

# bind mouse clicks using the Tkinter GUI toolkit
# (usually included in your Python installation)

import Tkinter as tk

def change_color(event):
    btn1.config(fg='red')

root = tk.Tk()
btn1 = tk.Button(root, text='Click me with the right mouse button ...')
btn1.pack()

btn1.bind('<Button-3>', change_color)  # bind right mouse click

root.mainloop()
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.