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

(Tkinter) Can I bind a key to Canvas?

P: n/a
Hi all,

I have a canvas and a rectangle draw on it. Can I bind a key(e.g. UP)
to the canvas and make the rectangle move up? Or shall I bind the key
to rectangle(I don't think so, because it is not a widget)?

Any suggestions are welcome!
Best regards,
Nov 21 '07 #1
Share this Question
Share on Google+
1 Reply

P: n/a
I have tried key and mouse click (when receive a event, print some
diagnose information ). I found mouse click work well in canvas but
key not work well.

It seems canvas cannot get key event?

self.canv.bind('<Up>',self._onUpKey) ## don't work
self.canv.bind('<Button-1>', self._onClick) ## work

Any suggestion?

Best regards,
Nov 21 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.