Hi all, I have set up an event handler and function to perform actions when a user presses certain keys in the plot window. The function needs access to variables that are in the main function. How do I pass these variables to the function.
In OnKeyPress, ImageNumber and Li are objects in the main program. Any ideas on how to pass them? Thanks plt.connect('key_press_event',OnKeyPress) def OnKeyPress(self,event): print 'button= ',event.key, event.xdata, event.ydata if event.key == 'm': ImageNumber = ImageNumber + 1 if event.key == 'n': ImageNumber = ImageNumber - 1 rawimage = Li.GetImage(ImageNumber) plt.imshow(rawimage) plt.title("Image number %3d" % (ImageNumber)) plt.draw() ------------------------------------------------------------------------------ Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more. http://p.sf.net/sfu/oracle-sfdev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users