Passing user defined variables to mouseclick/enter/leave events

Python-lover hemanexp at yahoo.com
Tue May 27 05:45:19 EDT 2003


hi,  I am using python and tkinter. Is it possible to pass user defined variables to and event that bind to mouse enter ("Enter" ) event. I want to pass some data to the event which is bound to "Enter" event. The coding is given below: ********************************************************self.canvas.tag_bind('movex1',"<Enter>",
         lambda type=1, xy=1:
         self.ChangeCursor(type,xy))
  self.canvas.tag_bind('movey1',"<Enter>",
         lambda  event,type=1, xy=2:
         self.ChangeCursor(type,xy))  def ChangeCursor(self,event,type,xy):
          if type == 1:    #Mouse enter event
               if xy == 1:  #X1/X2 position
                  self.canvas.config(cursor="sb_v_double_arrow")
              if xy == 2: #Y1/Y2 position
                  self.canvas.config(cursor="sb_h_double_arrow")      ************************************************************************  When i ran my program i got the following error: TypeError: ChangeCursor() takes exactly 4 arguments (3 given).   Where the problem exist and how can i pass user define variables to ChangeCursor routine? Thanx. 

---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030527/d9bc0cc5/attachment.html>


More information about the Python-list mailing list