Re: [Matplotlib-users] keypress event passing arguments

2010-12-14 Thread Michael Droettboom
You can create an class to store these values with a method to handle the callback, eg. (untested code): class KeyHandler: def __init__(self): self.ImageNumber = 0 def OnKeyPress(self, event): self.ImageNumber += 1 key_handler = KeyHandler() plt.connect('key_press_e

[Matplotlib-users] keypress event passing arguments

2010-12-11 Thread John
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 m