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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TMS
    New Member
    • Sep 2006
    • 119

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

    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
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by TMS
    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:
    Code:
    class traveler:
        # has a gif for display, etc set up in __init__()
        def GetLocation()
            return self.x, self.y
    AS AN EXAMPLE of what I'm thinking of.

    Comment

    • TMS
      New Member
      • Sep 2006
      • 119

      #3
      yes yes... I see. That would solve it. Thank you.


      tms

      Comment

      • bartonc
        Recognized Expert Expert
        • Sep 2006
        • 6478

        #4
        Originally posted by TMS
        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...

        Comment

        • TMS
          New Member
          • Sep 2006
          • 119

          #5
          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

          Comment

          Working...