Results 1 to 1 of 1
Hey ppl. Total noob question here and you'll probably know the answer right away. I'm writing a python program to get mouse clicks. Now what I'm wanting to do is ...
- 12-28-2008 #1Just Joined!
- Join Date
- Nov 2008
- Posts
- 22
Triggering Event in Python
Hey ppl. Total noob question here and you'll probably know the answer right away. I'm writing a python program to get mouse clicks. Now what I'm wanting to do is to trigger the Left Mouse Button Press Down when the Right button is pressed. What I'm not sure of is how to trigger that event. I've used the bind() to trigger events before using buttons, but now I just want to call it. Hope that makes sense. My code is below.
Jonney
Code:# File: mouse_class.py from Tkinter import * # Class to capture mouse clicks class mouse_class: def __init__(self, master): frame = Frame(master, width=200, height=200) frame.bind("<Button-1>", self.left_click) frame.bind("<Button-3>", self.right_click) frame.pack() def left_click(self, event): print "left-clicked at", event.x, event.y def right_click(self, event): # TRIGGER EVENT HERE # print "right-clicked at", event.x, event.y root = Tk() app = mouse_class(root) root.mainloop()


Reply With Quote