Images and mouse events

Wynand Singels 13812327 at sun.ac.za
Wed May 3 05:06:48 EDT 2006


Hi there everyone

I'm trying to figure out the best (and fastest way) to display a JPEG image
and then input several (x,y) coordinate pairs from mouse clicks on the
image.

I figured out how to do this in pylab using matplotlib as follows:

	img = 256 - S.misc.pilutil.imread('pic1.jpg')
	P.imshow(img)
	P.connect('button_press_event',click)
	P.show()

The function click() gets the coordinates form the event.xdata and
event.ydata, but this is very slow and cumbersome. 

The other option I was looking at was using wxPython - a staticbitmap with
EVT_LEFT_DOWN or something like that. But I'm struggling to get this to
work. 

Please take into account that my end product will have to have a full GUI.

Is there some other package I can use? Or am I missing some part of wxPython
that can do this?

Wynand




More information about the Python-list mailing list