Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40588

Re: listbox binding..what is the current selection?

Newsgroups comp.lang.python
Date 2013-03-05 17:26 -0800
References <78aa4ba0-a722-494c-b14b-2aa012dc01ae@googlegroups.com>
Message-ID <695d20a9-26e2-4b46-8fb2-0152d435b68f@googlegroups.com> (permalink)
Subject Re: listbox binding..what is the current selection?
From Rick Johnson <rantingrickjohnson@gmail.com>

Show all headers | View raw


On Tuesday, March 5, 2013 6:54:45 PM UTC-6, Rex Macey wrote:
> I have a listbox with two strings "Fixed" and "Random".
> [...] Here's the beginning of the set_lengthtype code:
> 
> def set_lengthtype(event=None): 
>    s=lbLengthtype.get(tk.ACTIVE)
>    print(s)  
>    .....
> 
> The print(s) statement is for debugging.  If 'Random' was
> selected and the user clicks 'Fixed',  then Random will
> print.  I would like to know what the user just selected,
> not what was selected before the user clicked.  How can I
> determine the current selection? Thanks.

Use "listbox.nearest(event.y)" instead of "get(ACTIVE"). And maybe you should spend some time reading the docs eh?

 http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

listbox binding..what is the current selection? Rex Macey <xer0925@gmail.com> - 2013-03-05 16:54 -0800
  Re: listbox binding..what is the current selection? Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-05 17:26 -0800
    Re: listbox binding..what is the current selection? Rex Macey <xer0925@gmail.com> - 2013-03-06 20:38 -0800
      Re: listbox binding..what is the current selection? Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-06 21:49 -0800
      Re: listbox binding..what is the current selection? William Ray Wing <wrw@mac.com> - 2013-03-07 10:13 -0500
        Re: listbox binding..what is the current selection? Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-07 09:03 -0800

csiph-web