Tuesday, January 12, 2010

Goal 3 : Mouse Events 1

Want to mess with mouse events if possible today... Goal : 4 will be more basic... should really look into variables a bit more ....

I used a little python today ... just the shell to do some basic calculations...
110 % 3 and a few others, for something I was writing.

Anyway... it 1:48 and I'm going to go ahead and check out mouse events for 15...



I got mouse events working in Tkinter, but I want system hooks ... and just found this:

(windows only)
http://pypi.python.org/pypi/pyHook/1.5.1

(osx cocoa - i think this is the way)
http://stackoverflow.com/questions/281133/controlling-the-mouse-from-python-in-os-x

...
So looks like Goal : 4 is still accessing mouse events... I Tkinter is good for interface stuff, but I need the system hook for what I'm working on...


Here is the Tkinter stuff:

# File: bind1.py

from Tkinter import *

root = Tk()

def callback(event):
print "clicked at", event.x, event.y

frame = Frame(root, width=100, height=100)
frame.bind("", callback)
frame.pack()

root.mainloop()

No comments:

Post a Comment