0

I'm working on a script in python,tkinter that draws a triangle and moves it around the screen. unfortunately I can't get the arrow to move. I've tried using canvas.move() but that wants an x and a y not the set of 3 coordinates I have to make it a triangle. Is there something I'm missing or maybe an easier way to move it? and help would be appreciated.

4
Contributors
7
Replies
14
Views
5 Years
Discussion Span
Last Post by Thropian
Featured Replies
  • 1

    This short code might just give you a hint: [url]http://www.daniweb.com/software-development/python/threads/191210/1558321#post1558321[/url] Read More

  • well I figured out what was wrong in my program. I was using[CODE]canvas.coords(tag,coordinates)#to move the object but I also needed canvas.tag_raise(tag)#to make the object appear on top[/CODE] Read More

0

Those are the coordinates you need to set for a traingle. Most graphical programs use an x,y coordinate system like so.
|-----------------x
|(0,0) (1,0) (2,0)
|(0,1) (1,1) (2,1)
|(0,2) (1,2) (2,2)
y

A triangle can be described as 3 points or this may also suprise you but possibly 4 points. If we start our triangle at (0,0), next draw a line to (0,2), then a line to (2,2), to finish we draw a line back to (0,0).

0

thanks for the try predator but I have 3 (x,y) sets but the canvas.move() wants a move for the x axis and the y axis. I'm looking for a way to define the new location.

Edited by Thropian: I realized what .move() was doing

0

Well what direction do you want it to move and when? You should only have to specify an offset for your new location. For example (x+1),(y+0). Beyond that I believe we may have to take a look at your code to see what you are trying to achieve.

0

I'm trying to get the arrow to move and turn by user actions I'll see if I can get a small working section of the code for you guys

1

well I figured out what was wrong in my program. I was using

canvas.coords(tag,coordinates)#to move the object but I also needed
canvas.tag_raise(tag)#to make the object appear on top
Votes + Comments
glad you got it working :)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.