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

Tkinter -> canvas: location of .gif from arrow event

TMS
100+
P: 119
Is there any way of determining the location of a gif grom an arrow event? For example I have a canvas that has a gif that moves and I want the arrow to move the gif. But how does the arrow know where the gif is? There is event.x that tells where the curser is, but how can one determine the location based on a keyboard arrow event?

tms
May 23 '07 #1
Share this Question
Share on Google+
4 Replies


bartonc
Expert 5K+
P: 6,596
Is there any way of determining the location of a gif grom an arrow event? For example I have a canvas that has a gif that moves and I want the arrow to move the gif. But how does the arrow know where the gif is? There is event.x that tells where the curser is, but how can one determine the location based on a keyboard arrow event?

tms
You'll need to be keeping track of that in your software, somewhere.
I kinda like the idea of a class object that travels around and can alway be asked where on the grid it is. You know, basically:
Expand|Select|Wrap|Line Numbers
  1. class traveler:
  2.     # has a gif for display, etc set up in __init__()
  3.     def GetLocation()
  4.         return self.x, self.y
AS AN EXAMPLE of what I'm thinking of.
May 23 '07 #2

TMS
100+
P: 119
TMS
yes yes... I see. That would solve it. Thank you.


tms
May 23 '07 #3

bartonc
Expert 5K+
P: 6,596
yes yes... I see. That would solve it. Thank you.


tms
Sounds like a fun project. I hope that you are enjoying youself and having FUN...
May 23 '07 #4

TMS
100+
P: 119
TMS
want the truth? NO, I'm not enjoying it. Its the same project I've been working on. This will be yet another rewrite to get it to work. Earlier this month I was working on the 'pacman' like game, well, I'm still working on it. Can't seem to get it right, and I'm about to give up.


tms
May 23 '07 #5

Post your reply

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