By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,427 Members | 1,356 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,427 IT Pros & Developers. It's quick & easy.

Tkinter event binding

P: 1
Right now I'm having trouble event binding an array of canvases.

You see I want to create an array of canvases binding with double click, these binds call a function that take in an argument.

my code is similar as follows

Expand|Select|Wrap|Line Numbers
  1. for dir in listofdir:
  2.   thumbnail = Canvas(Master)
  3.   thumbnail.bind("<Double-Button-1>",lambda x=dir: changedir(x))
  4.   thumbnail.pack()
  5.  
however python tells me that I'm trying to pass in an instance of an object rather than a string(the function changedir concates a string and the given argument)

Can anybody tell me what I'm doing wrong?
Nov 14 '08 #1
Share this Question
Share on Google+
1 Reply


Curtis Rutland
Expert 2.5K+
P: 3,256
Please enclose your posted code in [CODE] [/CODE] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [CODE] [/CODE] tags in future.

MODERATOR
Nov 14 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.