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

  • SEARCH
  • Home
  • 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 7948361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:42:06+00:00 2026-06-04T01:42:06+00:00

This is much like a traveling salesman problem. I have a Listbox with college

  • 0

This is much like a traveling salesman problem. I have a Listbox with college names in it(backed with coordinates I grabbed from the Facebook Graph). I have the selection mode set to multiple. I need to know the code that will allow me to use the colleges they selected so i can put them through a distance method. I only need to know the code to see what they selected. I tried using curselection() but I still do not understand it.

Here is some code:

    self.listbox = Listbox(self.mid_frame,width = 42,selectmode ="multiple",
                                        highlightcolor = "orange",
                                        highlightthickness = "10",bd = "5")

    coordinates = []
    collegelist = []
    f = open(sys.argv[1],'r')
    # grab the college's lat and long from facebook graph
    for identity in f:
        urlquery='https://graph.facebook.com/'+identity
        obj = json.load(urllib2.urlopen(urlquery))
        college = obj["name"]
        latitude = obj["location"]["latitude"]
        longitude = obj["location"]["longitude"]
        coordinates.append((college,latitude, longitude))
        collegelist.append(college)

    #sort the colleges so they appear alphabetical order
    sortcollege = sorted(collegelist)
    #fill Listbox with the College names imported from a text file
    for college in sortcollege:
        self.listbox.insert(END, college)

    self.listbox.pack(side = LEFT)
    #The label where I would put the total distance
    self.output_totaldist_label = Label(self.mid_frame,
                                    width = 11,
                                    textvariable = self.totaldistance)
    self.totaldistance = StringVar()
    self.output_label = Label(self.mid_frame,
                              textvariable = self.totaldistance)
    self.output_totaldist_label.pack(side = LEFT)
    self.output_label.pack(side = LEFT)
  • 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-06-04T01:42:08+00:00Added an answer on June 4, 2026 at 1:42 am

    It would have been nice to see how you tried curselection to see what went wrong.

    Something like:

    for idx in self.listbox.curselection():
        selitem = self.listbox.get(idx)
    

    should do the trick. Have you tried that?

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

Sidebar

Related Questions

I have an ajax loader much like this one: $('#loadingDiv') .hide() // hide it
Right now, lets say I have code much like this... $some_var=returnsUserInput(); function funcA($a) {...}
My problem is very much like this one . I run the simplest CUDA
Much like this question I want to generate an htpasswd file entry from PHP.
I have a library with an API much like this: public class Library :
I have an issue much like this user , but I want to take
I have a few tables in SQL that are pretty much like this A
I'm thinking about building a login system for Ruby on Rails, much like this
I'd like to add custom controls to the mediaPlayer control view much as this
This feels like it should be pretty simple, but not much seems to be

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.