Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6067163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:34:44+00:00 2026-05-23T09:34:44+00:00

here goes my first ever question, im doing a basic logplayer from data in

  • 0

here goes my first ever question, im doing a basic logplayer from data in a txt file:

the code is something like:

    for aircraft in self.logArray.itervalues():

        for logLine in aircraft:
            currentPoint = self.point(logLine[1], logLine[2])
            currentPoint = self.win2canvas(currentPoint)
            points = np.append(points, currentPoint)

        print points
        print np.size(points)
        self.canvas.create_line(points)
        points = np.array([])

So logArray is a dictionary, each name contains an array of kind [time,x,y], so there will be an array like that for each aircraft name.

The second for simply converts to tkinter canvas coords and appends the currentPoint to the pre-existing (and initialized).

When it gets to the create_line method, i get:

File "/home/joao/tese/workspace/ATC/src/autoATC/LogPlayer.py", line 131, in drawPath
self.canvas.create_line(points)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2204, in create_line
return self._create('line', args, kw)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2192, in _create
*(args + self._options(cnf, kw))))
_tkinter.TclError: wrong # coordinates: expected an even number, got 399

I’ve manually checked the size of the points array and is indeed even numbered. So i double-checked using np.size, which returned 398!

I’ve also tried using a very similar test approach, doing:

    self.canvas.create_line([123,345,234,453,23,34,45,56,67,78]) 

which went perfectly! I don’t get why, but somehow my points array ends up getting an extra element, and I don’t know where from!

Thank you for your time and patience!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:34:44+00:00Added an answer on May 23, 2026 at 9:34 am

    I believe that the issue is that you are using numpy arrays for this. The call stack here looks like this

    1. Tkinter.py, line 2160, in
      create_line return
      self._create(‘line’, args, kw)
    2. Tkinter.py, line 2148, in _create
      *(args + self._options(cnf, kw))))
    3. numeric.py, line 1424, in array_str
      return array2string(a,
      max_line_width, precision,
      suppress_small, ‘ ‘, “”, str)
    4. arrayprint.py, line 307, in
      array2string return lst

    If you have np.array([0., 0., 200., 100.]) the string that is returned by array2string() is ‘[ 0. 0. 100. 200.]’. I suspect that then it gets split returning the list of [‘[‘, ‘0.’, ‘0.’, ‘100.’, ‘200.]’] which has one extra element ‘[‘.

    You code should work if you use a list in place of np.array() or even if you just cast the numpy array to a list, like:

    self.canvas.create_line(list(points))
    

    Although, I would think that using a list from the start is more straight forward if you don’t need to use the functionality of numpy arrays.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my first question to stackoverflow so here it goes... I use cruise
This may seem like a stupid question, so here goes: Other than parsing the
Ok, this may be a dumb question but here goes. I noticed something the
First post, so here goes. I'm writing a script that does intelligent search and
I feel like a fool, but here goes: public interface IHasErrorController{ ErrorController ErrorController {
This question might be kind of elementary, but here goes: I have a SQL
Probably a long question for a simple solution, but here goes... I have a
I asked a similar question like this yesterday but after waiting for ever I
Here goes, second post, first didn't go to well.... I am calling an SP
I'm not sure if this is even possible but here goes: Currently I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.