How to determine row position in a list box

Discussion in 'Python' started by Scott Holmes, Aug 5, 2003.

  1. Scott Holmes

    Scott Holmes Guest

    I've been trying to understand nearest(y) but I'm not getting it. I
    have a ScrolledListBox with a list of people's names. I also have a
    parallel list of the unique people numbers used in the PostgreSQL
    database. When a name is selected from the scrolled list, I need to
    determine the index value and then find the corresponding people number.


    def selectionCommand(self):
    sels = self.box.getcurselection()
    if len(sels) == 0:
    print 'No selection'
    else:
    print 'Selection:', sels[0]
    print self.nmbr_list[self.box[0].nearest(y)]
    self.lkupTopLevel.withdraw()

    Where do I obtain the value y used in nearest(y)?

    --
    ---------------------------------------------------------------------
    Scott Holmes http://sholmes.ws
    http://pages.sbcglobal.net/scottholmes


    Independent Programmer/Analyst Passport 4GL
    PHP HTML Composer PostgreSQL Informix 4GL, SQL
    ---------------------------------------------------------------------
    There are more things in heaven and earth, Horatio,
    than are dreamt of in your philosophy
    ---------------------------------------------------------------------
    Scott Holmes, Aug 5, 2003
    #1
    1. Advertising

  2. > Where do I obtain the value y used in nearest(y)?

    Wouldn't that be sels[0]?

    Scott Holmes wrote:
    > I've been trying to understand nearest(y) but I'm not getting it. I
    > have a ScrolledListBox with a list of people's names. I also have a
    > parallel list of the unique people numbers used in the PostgreSQL
    > database. When a name is selected from the scrolled list, I need to
    > determine the index value and then find the corresponding people number.
    >
    >
    > def selectionCommand(self):
    > sels = self.box.getcurselection()
    > if len(sels) == 0:
    > print 'No selection'
    > else:
    > print 'Selection:', sels[0]
    > print self.nmbr_list[self.box[0].nearest(y)]
    > self.lkupTopLevel.withdraw()
    >
    > Where do I obtain the value y used in nearest(y)?
    >
    Daniel P. Engel, Aug 5, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Assaf
    Replies:
    0
    Views:
    367
    Assaf
    May 10, 2004
  2. Gnarlodious
    Replies:
    4
    Views:
    17,566
    elizas
    May 5, 2010
  3. Replies:
    1
    Views:
    527
  4. D
    Replies:
    0
    Views:
    199
  5. Peña, Botp
    Replies:
    1
    Views:
    225
    Robert Klemme
    Jan 24, 2004
Loading...

Share This Page